Table of Contents
ToggleEvery 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.
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.

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.
- Write the binary number and start at the rightmost bit.
- Split the bits into groups of 4 (nibbles).
- Add leading zeros to complete the leftmost group.
- Replace each nibble with its hex digit from the chart.
- 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.
- 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.
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.
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.
1 hex digit = 4 bits
2 hex digits = 8 bits = 1 byte
4 hex digits = 16 bits = 1 word
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.
| Binary | Hex | Decimal | Binary | Hex | Decimal |
|---|---|---|---|---|---|
| 0000 | 0 | 0 | 1000 | 8 | 8 |
| 0001 | 1 | 1 | 1001 | 9 | 9 |
| 0010 | 2 | 2 | 1010 | A | 10 |
| 0011 | 3 | 3 | 1011 | B | 11 |
| 0100 | 4 | 4 | 1100 | C | 12 |
| 0101 | 5 | 5 | 1101 | D | 13 |
| 0110 | 6 | 6 | 1110 | E | 14 |
| 0111 | 7 | 7 | 1111 | F | 15 |

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.
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.
Binary 11010110
Groups: 1101 | 0110
1101 = D, 0110 = 6
Result: D6 hex
Check: 13 × 16 + 6 = 214 decimal
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
- 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.
- 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.
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.
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
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.
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.
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.
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.
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.
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.
Related Articles
- Introduction to Number Systems
- Two's Complement
- Gray Code and Binary Conversion
- BCD Binary Coded Decimal
- Modbus Register Map
External References
- University of Texas at Arlington: Numeric Conversions lecture (PDF)
- CircuitBread: Binary, Hexadecimal and Other Base Numbers
- Wikipedia: Hexadecimal
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.

