Hex String to Binary Converter
Convert a compact hexadecimal string of any practical length directly into binary. Enter values such as DEADBEEF, 1A2B3C, ABC or 0xFF00 and get exact continuous binary plus full 4-bit nibble grouping.
Hex String to Binary Converter
The Hex String to Binary Converter converts a sequence of hexadecimal characters directly into an exact binary string. It is designed for multi-digit hexadecimal data such as DEADBEEF, A1B2C3, 123456789ABC or other long hexadecimal strings that are inconvenient to convert manually.
Every hexadecimal character is replaced with its exact four-bit binary equivalent. Because the conversion works character by character, very long values can be processed without converting the full string into a normal JavaScript number.
How to Convert a Hex String to Binary
Hexadecimal and binary map directly because one hexadecimal digit represents exactly four binary bits.
There is no need to convert the complete hexadecimal string to decimal first. Direct nibble mapping is both simpler and exact.
Why Every Hex Character Produces Four Binary Bits
Hexadecimal is base 16, while binary is base 2. Since 16 equals 2 to the fourth power, each base-16 digit corresponds perfectly to four base-2 digits.
A 3-character hex string therefore produces 12 bits, an 8-character string produces 32 bits, and a 16-character string produces 64 bits.
Hex String Length to Binary Length
| Hex String Length | Binary Length | Complete Bytes | Example |
|---|---|---|---|
| 1 digit | 4 bits | 0.5 byte | A → 1010 |
| 2 digits | 8 bits | 1 byte | A5 → 10100101 |
| 3 digits | 12 bits | 1.5 bytes | ABC → 101010111100 |
| 4 digits | 16 bits | 2 bytes | 1234 → 0001001000110100 |
| 6 digits | 24 bits | 3 bytes | FF00FF → 111111110000000011111111 |
| 8 digits | 32 bits | 4 bytes | DEADBEEF → 32 bits |
| 16 digits | 64 bits | 8 bytes | FFFFFFFFFFFFFFFF → 64 bits |
Example: Convert ABC Hex String to Binary
A hexadecimal string does not need an even number of characters. ABC is a valid three-character hexadecimal string.
The result contains 12 bits because three hexadecimal digits correspond to three nibbles.
Example: Convert 1234 to Binary
Leading bits are intentionally preserved in this string converter because the output represents the exact bit pattern implied by every hexadecimal character in the input.
Why Hex String Leading Zeros Are Preserved
In ordinary mathematical integer conversion, unnecessary zeros at the far left may be removed. Hex strings are often used to represent structured data, identifiers or raw bit patterns where the original width matters.
Removing those zeros would change the length relationship between the source string and its binary representation. This converter therefore maps every entered hexadecimal digit to all four of its bits.
Continuous Binary vs 4-Bit Grouped Binary
The calculator provides two useful views of the same result.
The continuous form is useful when you need a raw binary string, while four-bit grouping makes it easy to verify each original hexadecimal character.
8-Bit Byte View of a Hex String
When the hexadecimal string contains an even number of digits, pairs of hex characters naturally correspond to complete bytes.
The calculator provides an 8-bit byte view when possible. If the hex string has an odd number of characters, the final result contains a partial four-bit nibble rather than a complete last byte.
Odd-Length Hex Strings
An important difference between a generic hexadecimal string and a byte sequence is that a hex string can contain an odd number of characters.
This converter never adds hidden hexadecimal digits to make an input byte aligned.
Hex String vs Hex Byte Conversion
The Hex to Binary Byte Converter is restricted to exactly two hexadecimal digits because it represents one eight-bit byte. The Hex String to Binary Converter has a different purpose.
| Feature | Hex Byte | Hex String |
|---|---|---|
| Input length | Exactly 2 hex digits | 1 or more hex digits |
| Output width | Exactly 8 bits | 4 bits per hex character |
| Odd hex length | No | Yes |
| Primary use | Single byte | Multi-character hexadecimal data |
Hex String vs Hexadecimal Integer
Although the same characters can sometimes be viewed as either a numeric integer or a string of hexadecimal digits, the preferred output formatting can differ.
This converter follows the second interpretation. Every hexadecimal character is preserved as one four-bit unit.
Long Hex Strings and Numeric Precision
Large hexadecimal strings can exceed the exact integer range of ordinary JavaScript numeric types. Converting the entire input to a Number first could therefore cause incorrect output.
This calculator avoids that issue entirely. Each source character is looked up independently in a fixed hexadecimal-to-binary table, so the conversion remains exact regardless of the numerical magnitude of the overall string.
Common Hex String to Binary Examples
| Hex String | Nibble-Grouped Binary | Bit Length |
|---|---|---|
| A | 1010 | 4 |
| AB | 1010 1011 | 8 |
| ABC | 1010 1011 1100 | 12 |
| 1234 | 0001 0010 0011 0100 | 16 |
| A5FF | 1010 0101 1111 1111 | 16 |
| FF00FF | 1111 1111 0000 0000 1111 1111 | 24 |
| DEADBEEF | 1101 1110 1010 1101 1011 1110 1110 1111 | 32 |
| CAFEBABE | 1100 1010 1111 1110 1011 1010 1011 1110 | 32 |
Where Hexadecimal Strings Are Used
Hexadecimal strings are widely used because they provide a compact, human-readable representation of binary data.
- Debugging hexadecimal values from software.
- Inspecting encoded identifiers.
- Representing binary data in text.
- Cryptographic and checksum inspection.
- Analyzing raw application data.
- Working with long numeric constants.
- Viewing register or memory values.
- Testing parsers and data conversion code.
- Studying hexadecimal-to-binary relationships.
Common Hex String Conversion Mistakes
- Removing zeros that belong to an entered hexadecimal character.
- Assuming every hex string must contain an even number of digits.
- Converting a long string through an imprecise numeric type.
- Reversing the order of hexadecimal characters.
- Reversing the four bits inside individual nibbles.
- Counting one hexadecimal digit as eight bits instead of four.
- Including non-hexadecimal characters inside a compact hex string.
- Confusing hexadecimal string conversion with text encoding.
Hex String to Binary Converter FAQs
How do I convert a hex string to binary?
How many binary bits does each hex character produce?
Can a hexadecimal string have an odd number of digits?
What is DEADBEEF in binary?
What is ABC hex in binary?
What is CAFEBABE in binary?
Are leading zeros preserved?
Does the converter accept lowercase hexadecimal?
Can I use a 0x prefix?
Does the converter use decimal as an intermediate step?
Can it convert very long hexadecimal strings?
Is a hex string the same as hexadecimal text encoding?
Convert Long Hex Strings to Exact Binary
Enter a compact hexadecimal string above and select Convert Hex String. The tool maps every source character to exactly four bits, displays the continuous binary result, provides nibble and byte views, counts the resulting bits, and shows the conversion of every hexadecimal digit.