StringMash.com

Hex to binary converter

Each hex digit becomes four bits, with the working shown.

Conversion
3 characters
Updates as you type
Swap for binary to hex

Show the steps
  1. 16 is 2⁴, so each hexadecimal digit becomes 4 bits.
  2. 1 = 0001
  3. F (15) = 1111
  4. 4 = 0100
  5. Put the groups together: 0001 1111 0100
  6. Drop the zeros at the front: 111110100
Printable chart

Using the converter

Type a hex number, like 1F4 or 0x1F4, and the binary appears straight away, with each digit's four bits listed underneath. Capitals and lowercase both work. Set the binary to groups of 4 to keep the bits lined up with the hex digits they came from.

Several numbers can go in at once, separated by spaces, commas or new lines. Press swap to turn binary back into hex.

How to convert hex to binary

Replace each hex digit with its four bits, then join them up. 1F4 is 1, F and 4, which are 0001, 1111 and 0100, so it's 0001 1111 0100, or 111110100 once the zeros at the front are dropped.

It works because 16 is 2⁴, so every hex digit stands for exactly four binary digits and nothing carries from one to the next. There's no need to go through decimal. The table below lists the bits for every digit from 0 to F, and after a few uses most people know them by heart.

Why hex is used for binary

Long strings of 1s and 0s are hard to read and easy to miscopy. Hex packs them four to a digit, so a byte is two digits and a 32-bit value is eight, and the bits are still easy to recover. Memory addresses, colour codes, MAC addresses and byte dumps are all written in hex for that reason.

Questions

What is F in binary?

1111. F is 15, and 8 + 4 + 2 + 1 = 15.

What is FF in binary?

1111 1111, eight 1s, which is 255, the largest value one byte can hold.

Why do some answers start with zeros?

With groups of 4 switched on, the first group is padded to four bits so every group lines up with a hex digit. The zeros don't change the value.

How do I turn hex into text instead?

If the hex is bytes of text, like 48 65 6C 6C 6F, use the hex to text converter, which reads each pair of digits as a character.

THE FIRST 33 NUMBERS

Decimal, binary, octal and hex from 0 to 32

DecimalBinaryOctalHex
0000
1111
21022
31133
410044
510155
611066
711177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
16100002010
17100012111
18100102212
19100112313
20101002414
21101012515
22101102616
23101112717
24110003018
25110013119
2611010321A
2711011331B
2811100341C
2911101351D
3011110361E
3111111371F
321000004020

Sources

Added and reviewed . What's new