Skip to content
DailyCalc

Hex to Binary Converter

Converts hexadecimal to binary and back — each hex digit is exactly four bits.

Last updated

Your details

Result

Binary (base 2)
1101111010101101
Decimal (base 10)
57005
Hexadecimal (base 16)
DEAD
Octal (base 8)
157255
Bits needed
16

4 hex digits

DEAD in base 16…

value = Σ digit × baseᵖᵒˢⁱᵗⁱᵒⁿ

4 digits, read right to left

Each position is worth 16 times the one to its right

Total in decimal: 57005

57005

Formula — written step by step

Hexadecimal DEAD…

Each hex digit is exactly four bits

D = 1101

E = 1110

A = 1010

D = 1101

DEAD = 1101 1110 1010 1101

Sixteen is two to the fourth, so one hex digit maps onto exactly four binary digits with nothing left over. The conversion is a substitution, digit by digit, with no arithmetic and no carrying.

A worked example

Working out a file permission mask

Hex
0x1FF
Context
a Unix permission bitmask
  1. 1 = 0001
  2. F = 1111
  3. F = 1111
  4. Nine low bits, all set

111111111 — read as 777 in octal

Unix permissions are traditionally written in octal rather than hex, because three bits per digit maps onto the read/write/execute triple. This is the one place in computing where octal still beats hexadecimal, and it is why chmod takes 755 rather than 0x1ED.

How to use this calculator

  1. Enter a hexadecimal value; a leading 0x is accepted, and case does not matter.
  2. Read the binary, grouped into the four-bit blocks that correspond to each hex digit.
  3. Switch the mode to convert binary back to hexadecimal.
  4. Pad binary to a multiple of four from the left when converting by hand — leading zeros never change the value.

A clean four-to-one mapping

Because sixteen is two to the fourth power, every hexadecimal digit corresponds to exactly four binary digits. There is no remainder and no interaction between digits, so converting is a straight substitution rather than a calculation.

This is the practical reason hexadecimal exists in computing. It is a compact notation for binary — four times shorter — that can be converted back mentally and exactly, which decimal cannot.

Grouping and padding

Converting binary to hex means grouping bits into fours from the right, then replacing each group with its hex digit. If the leftmost group is short, pad it with leading zeros: 101101 becomes 0010 1101, which is 2D.

Padding from the right instead is a common and serious error — it multiplies the value. Leading zeros never change a number; trailing ones always do.

Where you will see it

Memory dumps, machine code, network packets and cryptographic hashes are all written in hex precisely because of this mapping. A 256-bit hash is 64 hex characters, and each character stands for four bits exactly.

Octal survives in one significant niche: Unix file permissions. Eight is two cubed, so an octal digit is three bits — which happens to match the read, write and execute triple perfectly. That is why chmod takes 755 rather than a hexadecimal value.

The complete nibble table

HexBinaryHexBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

Sixteen rows is the entire conversion. Memorising this table makes hex-to-binary a substitution you can do in your head, in either direction, at any length.

Frequently asked questions

Why is one hex digit exactly four bits?

Because 16 = 2⁴. Four binary digits have sixteen possible combinations, which is exactly the number of hex digits.

Do I pad from the left or the right?

The left, always. Leading zeros do not change the value; trailing zeros multiply it by two each time.

What is a nibble?

Four bits — half a byte, and exactly one hexadecimal digit. The name is a play on "byte".

Why do Unix permissions use octal rather than hex?

Because an octal digit is three bits, which matches the read/write/execute triple exactly. Hex would split those groups across digits.