Convert hexadecimal to binary
Convert hexadecimal to binary with a complete lookup table, worked examples, and practical guidance on leading zeros, bit width and copying results.
Hexadecimal-to-binary conversion is useful when you need to inspect individual bits in a number, byte or bit field. Each hexadecimal digit maps to exactly four binary digits, so the conversion is straightforward and preserves the numeric value when interpreted consistently. The tradeoff is length: binary takes four digits per hexadecimal digit when all groups are retained. Keep hexadecimal for compact reference and use binary when the bit pattern matters.
What the conversion changes
Hexadecimal represents numbers in base 16, using 0–9 and A–F. Binary represents numbers in base 2, using only 0 and 1. Conversion changes the written representation of a value; it does not reverse characters, mirror glyphs or apply a font. A converter that returns binary text changes the stored characters, rather than merely changing their appearance.
The input must represent a hexadecimal number. Converting the hexadecimal number AB is different from encoding the text characters A and B as bytes. Text encoding requires a separate encoding choice.
Hexadecimal-to-binary table
Use this chart to replace each hexadecimal digit with its four-bit equivalent. Lowercase a–f have the same values as uppercase A–F.
| Hexadecimal | Binary |
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
| A | 1010 |
| B | 1011 |
| C | 1100 |
| D | 1101 |
| E | 1110 |
| F | 1111 |
How to convert hexadecimal to binary
- 1. Identify the hexadecimal digits. A prefix such as 0x indicates the base and is not itself a digit to convert.
- 2. Replace each digit with four binary digits from the table.
- 3. Join the groups in their original order.
- 4. Keep leading zeros when a required bit width or the original grouping matters.
Hexadecimal: 2F
2: 0010
F: 1111
Grouped: 0010 1111
Binary: 00101111
For an ordinary unsigned integer, 00101111 and 101111 have the same numeric value. However, only the first retains the full eight-bit representation. Do not remove zeros from inside the result: each digit must contribute its complete four-bit group before any optional removal of leading zeros.
Converting binary back to hexadecimal
For an unsigned binary integer, group bits into sets of four from the right. If the leftmost group is short, pad it on the left with zeros, then use the table in reverse. For example, 110101 becomes 0011 0101, which gives hexadecimal 35. A numeric round trip can preserve the value without preserving the original leading zeros or letter case.
When the format needs extra care
Direct digit mapping preserves a bit pattern, but its meaning depends on context. For example, FF maps to 11111111; that pattern represents 255 as an unsigned integer or −1 as an eight-bit two’s-complement integer. Signed values therefore need an agreed representation and bit width. Fractions and floating-point encodings also need explicit rules beyond the integer procedure shown here.
Convert digits in the supplied order. Endianness concerns how bytes are ordered when storing or interpreting a multibyte value; it is not a reason to reverse digits during ordinary hexadecimal-to-binary conversion.
Choosing a converter and sharing the result
A suitable hexadecimal binary converter should make its accepted input format and output width clear. Check whether it accepts prefixes or spaces, retains leading zeros and rejects invalid digits. No specific converter, destination or assistive technology was supplied or tested here, so its handling of these details remains unverified.
For copying into another program, use ordinary text digits and follow that program’s required syntax. Spaces can make four-bit groups easier to inspect, but the receiving field may require a continuous string. Label the base in surrounding prose so that a string such as 1010 is unambiguous.
Binary output can remain plain text without decorative Unicode characters or visual styling. For human readers, accompany long bit strings with their hexadecimal equivalent and explain what the bits represent. Do not assume a screen reader will announce a digit sequence in the intended way; provide a prose explanation when understanding the value matters.