Solved.tools — Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

Hex to Binary Converter

Last updated: 20 August 2026

Reviewed by Gavin · Research and drafting assisted by AI

Input base
Valid hexadecimal — 2 digits.
HEX2D
BIN101101
OCT55
DEC45

Working — hex ⇄ binary by 4-bit grouping

1. Binary value: 101101
2. Left-pad to a multiple of 4 (2 zeros added): 00101101
3. Split into 4-bit groups from the right: 0010 | 1101
001021101D
4. Concatenate the hex digits: 2D
Octal cross-check (3-bit groups, 8 = 2³): 101 | 101 = 55
Decimal cross-check (base 10): 45

Hex digit → 4-bit nibble table

0 = 00001 = 00012 = 00103 = 00114 = 01005 = 01016 = 01107 = 01118 = 10009 = 1001A = 1010B = 1011C = 1100D = 1101E = 1110F = 1111

Verified examples

Reference: Hexadecimal is base 16 and binary is base 2, so 16 = 2⁴ and every hex digit is exactly four binary digits — conversion is a lookup, not arithmetic. Octal (base 8 = 2³) uses three-bit groups the same way. Decimal (base 10) has no such relationship with base 2 and requires true base arithmetic. Digit and radix notation follow ISO/IEC 80000-2:2019; the bit-grouping shortcut is described in Knuth, The Art of Computer Programming Vol. 2 §4.1 (Positional Number Systems). All values are computed with BigInt arithmetic, so results stay exact for bit strings of any length.
Was this helpful?


Hex to Binary Converter

A hex to binary converter turns a string of hexadecimal digits into the equivalent binary ones and zeros, and back again, using a shortcut that requires no arithmetic at all. Because sixteen is exactly two to the fourth power, every single hex digit corresponds to exactly four binary digits, so the conversion is a straight substitution rather than a calculation. This converter handles that substitution instantly, shows you the grouped nibbles so you can follow the working, and simultaneously displays the same value in octal and decimal so you never have to open a second tool.

Hex is the notation of choice for almost everyone who reads raw memory: assembly programmers, embedded systems engineers, hardware designers, security researchers examining packet dumps, and students working through their first computer architecture course. A single 32-bit word written in hex is eight characters, the same word in binary is thirty-two characters of visual noise. The hex form compresses the bit pattern to a quarter of its length with no loss of information, which is exactly why hex became the standard shorthand for binary in the first place.

How to Use the Hex to Binary Converter

  1. Choose your input base using the four buttons: HEX (base 16), BIN (base 2), OCT (base 8) or DEC (base 10).
  2. Type your value into the input field. Only digits valid for the chosen base are accepted, hex takes 0 through 9 plus A through F, binary takes 0 and 1, octal takes 0 through 7, and decimal takes 0 through 9.
  3. All four representations update live as you type. There is no calculate button and no page reload.
  4. Read the working panel underneath to see exactly how the binary string was padded, split into four-bit nibble groups, and mapped to hex digits.
  5. Use the copy buttons beside each output to grab any of the four representations.
  6. Click any of the verified example buttons to load a hand-checked test case.

If you paste an invalid character, a G in a hex field, or a 2 in a binary field, the input border turns red and a message tells you which digits are permitted. Nothing is silently discarded, so you always know what the tool is actually converting.

The Method: Why Four Bits Make One Hex Digit

Hexadecimal is base 16. Binary is base 2. And 16 = 2⁴. That single relationship is the whole trick.

In any positional number system, a digit in position i (counting from zero at the right) contributes digit × base^i to the total. In binary the place values run 1, 2, 4, 8, 16, 32, 64, 128, and so on. In hex the place values run 1, 16, 256, 4096, 65536. Notice that the hex place values are exactly the binary place values at positions 0, 4, 8, 12, 16, every fourth one. That alignment means a block of four binary digits always represents a value from 0 to 15, which is precisely the range of a single hex digit, and the blocks never overlap or carry into one another.

The procedure, then:

Hex → Binary

  1. Replace each hex digit with its four-bit nibble using the fixed table below.
  2. Concatenate the nibbles in order.
  3. Strip any leading zeros from the result, keeping at least one digit.

Binary → Hex

  1. Pad the binary string on the left with zeros until its length is a multiple of four.
  2. Split into four-bit groups starting from the right (the least significant bit).
  3. Replace each group with its hex digit using the table below.
  4. Strip leading zeros from the result, keeping at least one digit.

The full lookup table, which is worth memorising because it never changes:

Hex digit4-bit nibbleHex digit4-bit nibble
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

Octal works identically with three-bit groups, because 8 = 2³. That is the entire reason both octal and hexadecimal became standard in computing: they are the two common bases that compress binary neatly without any arithmetic. Base 10 has no such relationship with base 2, ten is not a power of two, which is why decimal conversion genuinely requires repeated division or multiplication.

Worked Examples

Example 1, A single byte of all ones

Convert FF to binary.

Look up each digit: F = 1111, F = 1111. Concatenated: 11111111. Eight bits, one byte, every bit set, the byte maximum in unsigned two's-complement. In decimal this is 255 (15 × 16 + 15), and in octal it is 377 (3 × 64 + 7 × 8 + 7). All four representations are the same number.

Example 2, A small hex value

Convert 2D to binary.

Look up: 2 = 0010, D = 1101. Concatenated: 00101101. Strip the leading zero: 101101. In decimal this is 45 (32 + 8 + 4 + 1), and in octal it is 55 (5 × 8 + 5). The same value, four different ways of writing it.

Example 3, A power of sixteen

Convert 100 to binary.

Look up: 1 = 0001, 0 = 0000, 0 = 0000. Concatenated: 000100000000. Strip the leading zeros: 100000000. Nine bits, exactly 256 in decimal (1 × 256 + 0 + 0). This is a nice one to remember. In hex, 100 is 16², so it is written 100 for the same reason 100 in decimal is 10². Powers of sixteen are always a one followed by zeros in hex.

Example 4, A 32-bit pattern that everyone recognises

Convert DEADBEEF to binary.

Look up each digit: D = 1101, E = 1110, A = 1010, D = 1101, B = 1011, E = 1110, E = 1110, F = 1111. Concatenated: 11011110101011011011111011101111. Thirty-two bits, one word, displayed in eight nibbles. In decimal this is 3,735,928,559, and in octal it is 33653337357.

DEADBEEF is the classic hexadecimal sentinel value, easy to spot in a hex dump because it spells out the word "DEAD BEEF" in ASCII fragments. Software engineers, hardware designers, and operating system developers have used it for decades as a "magic number" to mark uninitialised memory, freed heap blocks, and stack canaries. It is one of the most famous patterns in computing, and it converts to binary exactly the way any other hex string does.

Example 5, Binary back to hex

Convert binary 11111111 to hex.

Eight bits, already a multiple of four, so no padding needed. Split from the right: 1111 | 1111. Look up: F and F. The result is FF in hex.

This is the byte maximum again, and the symmetry is the point. Going hex to binary and binary to hex are the same operation in opposite directions, and the same table does both jobs.

Example 6, The ASCII character "A"

The ASCII code for the capital letter "A" is 65 in decimal, which is 41 in hex. Look up: 4 = 0100, 1 = 0001. Concatenated: 01000001. Strip leading zeros: 1000001. Seven bits, the original ASCII range.

This is the pattern that connects hex to virtually every text file on a computer. Each byte of a UTF-8 or ASCII text file is most naturally read in hex, and the entire file is a sequence of bytes that can be concatenated into one long binary string. The hex editor is just a binary viewer with a shorter display.

Common Mistakes

Grouping from the left instead of the right. This is the single most common error. Padding and grouping must both be anchored at the least significant bit, on the right. If you group 11111111 from the left you get 1111 | 1111 which is correct, but if you had a string like 1111100000 and grouped from the left as 1111 | 1000 | 00, that trailing two-bit fragment has no valid hex digit. Always pad the left, always group from the right.

Forgetting to pad at all. If the bit count is not a multiple of four, skipping the pad leaves an orphan group of one, two, or three bits at the most significant end. Add the leading zeros first; they never change the value, exactly as writing 007 does not change the number seven.

Mixing up the hex and octal group sizes. Hex takes four bits, octal takes three. Using three-bit groups and then reading them as hex digits produces nonsense values. If your "hex" result contains a letter beyond F, you have used the wrong group size.

Assuming decimal converts the same way. It does not. Ten is not a power of two, so there is no clean bit-grouping shortcut to decimal. Converting binary to decimal requires summing place values, and decimal to binary requires repeated division by two. This is why programmers reach for hex rather than decimal when reading raw memory.

Treating a leading zero as a separate issue. In many programming languages, notably C and older versions of JavaScript, a numeric literal beginning with 0 is interpreted as octal, while a literal beginning with 0x is interpreted as hex. Writing 010 in C gives you the value eight, not ten. Modern languages tend to use an explicit 0o prefix for octal to avoid the ambiguity, but the legacy behaviour still catches people out.

Losing precision on very long values. Some converters route everything through a standard floating-point number, which loses exactness above 2⁵³, roughly sixteen decimal digits. This converter uses BigInt arithmetic throughout, so a 256-bit value (a 64-hex-digit representation) converts exactly. The practical limit is browser memory and how much you are willing to scroll, not numerical precision.

Where Hex Is Actually Used

Hex is everywhere in computing. The most visible everyday use is memory addresses, every debugger, every kernel panic message, every null-pointer dump shows addresses in hex because the address space is naturally a power of two and the trailing zeros are visually obvious. The classic 32-bit address 0xDEADBEEF looks the same whether the system is little-endian or big-endian when written as a hex literal, which is part of why hex became standard.

Beyond addresses, hex dominates colour codes in web design and digital graphics. The CSS colour #FF8800 is a 24-bit value split into three bytes: red 0xFF (255), green 0x88 (136), blue 0x00 (0). Every browser, every image editor, every design tool speaks hex because it is the most compact way to write a 24-bit pixel.

Assembly language and machine code are essentially written in hex. The x86 instruction 0xB8 0x01 0x00 0x00 0x00 is the four-byte instruction that moves the value 1 into the EAX register, and the bytes are most naturally read in hex. An entire executable file is a long hex string under the hood.

Network packet captures are frame dumps that list the bytes of each packet in hex with an ASCII interpretation on the right. The standard xxd and hexdump tools produce output in exactly this format. Reading a packet capture forensically without understanding hex is nearly impossible.

Cryptographic hashes are conventionally written in hex. SHA-256 produces a 256-bit value, which is 64 hex characters, short enough to copy-paste, long enough to be a unique fingerprint. The MD5 hash of an empty string is D41D8CD98F00B204E9800998ECF8427E, and the same fingerprint is the same 128-bit value regardless of how the hash is computed.

Unicode code points for characters outside the ASCII range are conventionally written in hex with a U+ prefix. The euro sign € is U+20AC, and the same value is 0xE2 0x82 0xAC in UTF-8. Hex is the bridge between the universal character set and the byte streams that files actually store.

MAC addresses for network hardware are six bytes written as twelve hex digits, separated by colons or hyphens. 01:23:45:67:89:AB is the MAC address of a particular Ethernet card, and the address is the same no matter which endian convention the controller uses internally.

Frequently Asked Questions

Why is hex to binary so much easier than decimal to binary?

Because 16 is a power of 2 and 10 is not. Since 16 = 2⁴, four binary place values line up exactly with one hex place value, so conversion is a pure substitution with no carries and no arithmetic. Decimal has no such alignment, so converting to or from base 10 requires genuine calculation, repeated division by 2, or summing each bit's place value. The same shortcut applies to octal because 8 = 2³, which is why both octal and hexadecimal became standard shorthand for binary while base 10 never did.

Do I group the bits from the left or the right when converting binary to hex?

Always from the right, at the least significant bit. Positional weight increases leftwards, so anchoring at the right keeps each four-bit block aligned with a hex place value. If the total bit count is not divisible by four, add leading zeros on the left to make up the difference, those zeros carry no value, so the number is unchanged. Grouping from the left instead is the most frequent source of wrong answers in base conversion exercises.

What happens to leading zeros in the result?

They are dropped, because leading zeros do not change a number's value. If you convert the hex value 00FF you get nibbles 0000 | 0000 | 1111 | 1111, which concatenate to 0000000011111111, and lead-zero stripping gives 11111111, the same binary as FF alone. The one exception is the value zero itself, which must keep a single digit so that the output is not an empty string. Note that in C and some other languages a written leading zero on a literal actually signals octal notation, which is a separate convention and not a property of the number.

Can this converter handle very long hex strings?

Yes. All arithmetic runs on BigInt rather than standard floating-point numbers, so values far beyond 2⁵³, the point where ordinary double-precision arithmetic starts losing whole integers, convert exactly. A 256-bit value (a 64-hex-digit string) will produce a correct binary, octal and decimal result with no rounding. The practical limit is browser memory and how much you are willing to scroll, not numerical precision.

Why do programmers use hex instead of just writing binary?

Hex compresses binary to a quarter of its length without changing any bits. A 32-bit word is 32 binary characters, but only 8 hex characters. The mapping is also trivially memorisable, every hex digit is a unique four-bit pattern, so converting back and forth is fast. Colour codes, memory addresses, byte values, hash digests, and Unicode code points are all written in hex for exactly this reason. Octal compresses to a third, but octal digits only cover three bits each, which does not align with the byte boundaries that define modern computer architectures.

How do I recognise hex notation in code?

The most common convention is the 0x prefix, used in C, C++, Java, JavaScript, Go, Rust, Python, and most other languages: 0xFF, 0xDEADBEEF, 0xCAFE. Some languages use 0X (uppercase X) or a hash prefix (#FF8800 in HTML/CSS) or a dollar sign ($FF in Pascal). In assembly language, hex is often the default, with no prefix at all, MOV AX, FF means move the hex value FF into the AX register. The convention is a property of the language, not the number.

Is hex case-sensitive?

The hex digits themselves are case-insensitive: A and a both mean ten, F and f both mean fifteen. The convention is usually uppercase (0xDEADBEEF) when the value is meant to look like an acronym or a memory address, and lowercase (0xdeadbeef) when the value is just a number. Most code formatters pick one or the other and stick with it. This tool shows hex output in uppercase by default, but it accepts input in either case.

How can I check a hex-to-binary conversion by hand?

Convert both the input and the output to decimal and confirm they match. For hex, multiply each digit by the appropriate power of 16 (1, 16, 256, 4096, 65536, ...) and add. For binary, sum the place values of each 1 bit (1, 2, 4, 8, 16, 32, ...). If the two decimal totals agree, the conversion is correct. Working through 2D2 × 16 + 13 = 45 and 10110132 + 8 + 4 + 1 = 45 is a good habit to build, and it catches grouping errors immediately.

can the Hex to Binary Converter be used for professional or commercial purposes?

Yes. The conversion is deterministic and exact, base conversion between hex, binary, octal and decimal has a single mathematically correct answer with no approximation, estimation or judgement involved, and BigInt arithmetic guarantees no precision loss at any length. That said, for safety-critical, regulatory or contractual work you should independently verify any result that feeds into a decision, ideally by hand-checking the decimal cross-sum described above or by comparing against a second implementation.

For the Hex to Binary Converter, How often are the underlying formulas updated?

The formulas here are fixed properties of positional numeral systems and do not change. The relationships 16 = 2⁴ and 8 = 2³, and the nibble-digit mappings that follow from them, are the same today as when they were first codified and will be the same indefinitely. Notation conventions follow ISO/IEC 80000-2:2019 and the treatment in Knuth's The Art of Computer Programming Volume 2, §4.1. The tool itself is reviewed periodically for interface and accuracy improvements, but the mathematics is settled.


Also try these free tools: