Binary to Hexadecimal Conversion: Chart & Calculator

Share:
Digital Electronics
Binary to Hexadecimal Conversion: 4 Bit Grouping Method, Chart, Solved Examples and PLC Register Uses

Every PLC register, Modbus map and memory address you meet on site is easier to read in hex than in long strings of ones and zeros. Here you get the 4 bit grouping trick, a full chart, solved examples and a calculator.

4 Bit Nibbles 0000 to 1111 Chart Fraction Examples Modbus and PLC Use Free Calculator

Change any binary number into hexadecimal by grouping its bits in sets of four. The page includes solved examples, a conversion chart and a working calculator.

Hello everyone, today we are going to learn binary to hexadecimal conversion with the simple nibble method, a ready chart, solved field examples and a calculator.
binary to hexadecimal conversion
Quick Answer

How does binary to hexadecimal conversion work?

Binary to hexadecimal conversion works by splitting the binary number into groups of 4 bits, starting from the right, and replacing each group with one hex digit from 0 to F. This works because 16 equals 2 raised to the power 4, so one nibble always maps to exactly one hex digit. For example, 1101 0110 becomes D6, which equals 214 in decimal.

  1. Write the binary number and start at the rightmost bit.
  2. Split the bits into groups of 4 (nibbles).
  3. Add leading zeros to complete the leftmost group.
  4. Replace each nibble with its hex digit from the chart.
  5. Join the digits and add the 0x prefix or the subscript 16.

What Is Binary to Hexadecimal Conversion?

Binary to hexadecimal conversion rewrites a base 2 number as a base 16 number by replacing every group of four bits with a single hex digit. Long, error prone bit strings become short codes such as 0x3F or 0xD6 that you can read, type and compare quickly.

Key Facts
  • Hexadecimal is base 16 and uses the digits 0 to 9 and the letters A to F.
  • One hex digit always represents exactly 4 bits, called a nibble.
  • Two hex digits make one byte, and four hex digits make one 16 bit word.
  • No division or multiplication is needed, only grouping and a lookup chart.
  • Hex is the default view for PLC registers, Modbus data and memory addresses.

If you are new to bases and place values, first read our introduction to number systems, because hex is simply one more positional system. Binary uses powers of 2, decimal uses powers of 10 and hexadecimal uses powers of 16.

Do You Know?

The word hexadecimal mixes the Greek hex (six) with the Latin decimal (ten), and IBM helped popularise the letters A to F for the extra six digits when its System/360 computers documented memory dumps in base 16 during the 1960s.

Advertisement

Why Do We Group Binary Digits in Fours?

We group binary digits in fours because 2 raised to the power 4 equals 16, so four bits have exactly sixteen possible patterns, one for each hex digit. So the whole method is a chart lookup with nothing to calculate.

Base relation: 16 = 24
1 hex digit = 4 bits
2 hex digits = 8 bits = 1 byte
4 hex digits = 16 bits = 1 word
Quick Tip

Memorise only four anchor values: 8 is 1000, A is 1010, C is 1100 and F is 1111. Every other nibble is one step above or below one of these, so you can work out the whole chart in your head from these four.

Binary to Hex Conversion Table (0000 to 1111)

The binary to hex conversion table lists all sixteen 4 bit patterns with their hex and decimal values, and it is the only reference you need. Keep it on your desk until you know the patterns by heart.

BinaryHexDecimalBinaryHexDecimal
000000100088
000111100199
0010221010A10
0011331011B11
0100441100C12
0101551101D13
0110661110E14
0111771111F15
binary to hexadecimal conversion table showing hex 3E9B mapped to binary 0011111010011011
Image credit: CircuitBread. The table shows each hex digit of 3E9B written directly below its own 4 bit binary group.

How to Convert Binary to Hex Step by Step

To convert binary to hex, split the bits into nibbles from the right, pad the last group with leading zeros, and replace each nibble with its hex digit. The five steps below work for any length of number.

1
Start at the right
Begin at the least significant bit, the rightmost one, because place values grow from right to left.
2
Make groups of four
Mark off every four bits moving left, and a space between groups makes errors easy to spot.
3
Pad with zeros
If the last group on the left has fewer than four bits, add zeros in front, which never changes the value.
4
Look up each nibble
Replace each group with its digit from the chart, for example 1011 becomes B.
5
Write the result
Join the digits in the same order and mark the base with 0x, a trailing h or a subscript 16.

The mistake students make most often is grouping from the left. If you split 101101011 from the left you get 1011 0101 1 and a wrong answer, so always start on the right.

Binary to Hexadecimal Conversion Solved Examples

These solved examples apply binary to hexadecimal conversion to an 8 bit byte, an odd length number and a 16 bit register value. Work each one on paper first and then check it with the calculator below.

Example 1 (calculator default):
Binary 11010110
Groups: 1101 | 0110
1101 = D, 0110 = 6
Result: D6 hex
Check: 13 × 16 + 6 = 214 decimal
Example 2 (odd length):
Binary 101101011 (9 bits)
Pad: 0001 | 0110 | 1011
Digits: 1, 6, B
Result: 16B hex
Check: 256 + 96 + 11 = 363 decimal

Nine bits do not divide into fours, so three leading zeros complete the left group. The check uses place values of 256, 16 and 1 for the three hex positions.

Example 3 (16 bit status word):
Binary 0000 0100 1000 0001
Digits: 0, 4, 8, 1
Result: 0x0481
Bits set: 0, 7 and 10

The third pattern is typical of a drive or analyser status word. From 0x0481 you can see at once that bits 0, 7 and 10 are on, which is far quicker than counting sixteen ones and zeros.

Advertisement

How to Convert Binary Fraction to Hexadecimal

To convert a binary fraction to hexadecimal, group the bits left of the point from the right and the bits right of the point from the left, padding each side with zeros. Each group then becomes one hex digit, and the point stays exactly where it was.

Binary 1011.101
Integer part: 1011 = B
Fraction: 101 → pad → 1010 = A
Result: B.A hex
Check: 11 + 10/16 = 11.625

How to Convert Hexadecimal to Binary

To convert hexadecimal to binary, replace each hex digit with its 4 bit pattern from the chart and join the groups. Going the other way is just as fast and needs no arithmetic at all.

Hex input0x3E9B
Split digits3, E, 9, B
Look up nibbles0011, 1110, 1001, 1011
Join groups0011111010011011
Drop leading zeros11111010011011 if required

Keep the leading zeros when the value is a register or a mask, because the bit positions matter. Drop them only when you need the plain number, which is the same rule used in PLC bit shift and rotate instructions.

Do You Know?

Hex is also the shorthand for floating point numbers. In the IEEE 754 single precision format, the value 1.0 is stored as 0x3F800000, which is the binary pattern 0011 1111 1000 0000 followed by sixteen zeros.

Free Binary to Hex Calculator

This calculator does binary to hexadecimal conversion for whole numbers and fractions and shows the decimal value too. Type only zeros and ones, with an optional point for fractions.

Binary to Hex and Decimal Calculator
Result
Hex D6 and decimal 214

The default value is Example 1, so pressing Calculate should show D6 and 214. If you need to turn raw analog counts into engineering units afterwards, our PLC raw count calculator handles that next step.

Where Binary to Hexadecimal Conversion Is Used in PLCs and Modbus

In automation you use binary to hexadecimal conversion every day to read register values, decode status and fault words, set bit masks and read memory addresses. Most programming software, HMI diagnostics and protocol analysers show data in hex by default.

Modbus register maps
Vendors list holding registers and coil addresses in hex, so 0x0010 is register offset 16.
Status and fault words
A 16 bit alarm word such as 0x0481 shows which bits are set at a glance.
Bit masks
Masks like 0x00FF keep the low byte, and 0xFF00 keeps the high byte of a word.
Memory addresses
Microcontroller memory maps and PLC data blocks are documented with hex addresses.

The Modbus register map of a flow meter or energy meter is where you will use this most. The Modbus function codes are also hex values, so function code 0x03 reads holding registers.

According to the Modbus Application Protocol specification, an exception response adds 0x80 to the function code, so a failed 0x03 request returns 0x83. Spotting that byte in a capture is often the first clue during Modbus RTU troubleshooting.

Microcontrollers work the same way. ARM documents the Cortex M memory map with the SRAM region starting at 0x20000000, and you will see such addresses while studying the microcontroller working principle.

Quick Tip

When a manual lists a register as 40001 but your master software asks for an address, try offset 0x0000 first. Many devices use zero based addressing on the wire even though the document counts from one.

Advertisement

Binary vs Hexadecimal: Which Is Better to Read?

Hexadecimal is better for people to read and write, while binary is better when you need to see every single bit. Most engineers think in hex and switch to binary only when they test individual flags.

Why engineers prefer hex
  • Four times shorter than binary for the same value.
  • Each digit maps cleanly to one nibble of a register.
  • Fewer typing mistakes when entering masks and addresses.
  • Standard format in datasheets, memory dumps and analysers.
Where hex can mislead
  • Individual bits are hidden until you expand the digit.
  • Letters B and 8 or D and 0 can be misread on small screens.
  • Signed values in two's complement look like large numbers.
  • Without a prefix, 10 could mean ten or sixteen.

Signed values need care. In two's complement a 16 bit 0xFFFF means minus 1 for an INT tag but 65535 for a WORD tag, so always check the data type before trusting the number.

Hex is not the same as other binary codes. A BCD value also uses nibbles, but only 0000 to 1001 are legal, and Gray code conversion changes the bit pattern itself rather than just its written form.

Myth: Converting to hex changes the data stored in the PLC.
Fact: Hex is only a way of displaying the bits, and the stored pattern is identical in every base.
Myth: You must convert binary to decimal before you can get hex.
Fact: Direct 4 bit grouping is faster and avoids rounding and arithmetic errors completely.
Myth: Leading zeros can always be ignored.
Fact: In registers and masks the leading zeros show bit positions, so dropping them can hide the real width.

Common Mistakes and Troubleshooting Tips

Most wrong answers come from grouping in the wrong direction, padding the wrong side of a fraction or confusing similar looking digits. The checklist below catches nearly all of them.

  • Group integer bits from the right, never from the left.
  • Pad the integer part on the left and the fraction part on the right.
  • Keep leading zeros when the value is a register, mask or address.
  • Check whether the tag is signed or unsigned before reading 0x8000 and above.
  • Cross check one answer through decimal using place values of 1, 16 and 256.

For practice with the logic side, our pages on digital logic gates and Boolean algebra show how a mask such as AND 0x0F works at the bit level.

PDF
Numeric Conversions: Hexadecimal, Decimal and Binary
University of Texas at Arlington, Embedded Systems I lecture notes (PDF)

The University of Texas at Arlington lecture notes above work through hex, decimal and binary conversions for embedded systems students. The short video below from Khan Academy shows the direct grouping method on a whiteboard.

Binary to Hexadecimal Conversion FAQ

How do you convert binary to hexadecimal step by step with example?

Split the bits into groups of four from the right, pad the leftmost group with zeros and replace each group with its hex digit. For example, 11010110 becomes 1101 and 0110, which gives D and 6.

The final answer is D6, which equals 214 in decimal, and you can confirm it with the calculator on this page.

What is the difference between binary and hexadecimal number systems?

Binary is base 2 and uses only 0 and 1, while hexadecimal is base 16 and uses 0 to 9 plus A to F. One hex digit replaces four binary digits exactly.

So the byte 11111111 is simply FF, and both forms store the same bit pattern in memory.

Why are binary digits grouped in fours when converting to hex?

Four bits give exactly 16 combinations, and 16 is the base of hexadecimal, so each nibble matches one hex digit. This is why binary to hexadecimal conversion needs only a lookup chart and no division.

Octal uses groups of three for the same reason, since 8 equals 2 cubed.

How to convert a binary fraction like 1011.101 into hexadecimal?

Group the integer bits from the right and the fraction bits from the left, padding the fraction with zeros on the right. So 1011.101 becomes 1011 and 1010, which gives B.A in hex.

In decimal that equals 11.625, because A over 16 is 0.625.

What is the most common mistake in binary to hex conversion?

The most common mistake is grouping the bits from the left instead of the right. Splitting 101101011 from the left gives a wrong answer, while correct grouping gives 0001 0110 1011, or 16B.

Padding a fraction on the wrong side is the second most frequent error students make.

Why do PLC and Modbus engineers use hex instead of binary?

Hex is four times shorter than binary, so a 16 bit status word such as 0x0481 fits in four characters. That makes register maps, masks and fault codes much easier to read and type.

Modbus analysers also show every frame byte in hex, including function codes like 0x03 and exceptions like 0x83.

Advertisement

Related Articles

External References

What We Learn Today

  • Binary to hexadecimal conversion works by grouping bits into nibbles of four from the right and replacing each nibble with one hex digit.
  • Fractions are grouped outward from the point, with zeros added on the left of the integer part and the right of the fraction.
  • Hex is the everyday language of PLC registers, Modbus maps, bit masks and memory addresses, so always check data type and byte order.
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!
Sunayana Gadepatil, author at Instrumentation Blog
Author · instrumentationblog.in
Ms. Sunayana Gadepatil is an instrumentation professional, technical writer, and the author behind Instrumentation Blog. With a strong interest in industrial instrumentation, process measurement, and automation, she specializes in simplifying complex technical concepts into clear, practical, and easy to understand insights. Through her articles, Ms. Sunayana shares valuable knowledge on flow, pressure, level, temperature, control systems, and industrial automation for engineers, students, technicians, and industry professionals.
Technically reviewed on

Leave a Reply

Your email address will not be published. Required fields are marked *