0xCONVERTER-HEX

Reference

Hex to Binary Conversion Table

The sixteen nibble patterns, then every byte from 00 to FF written out in bits.

The sixteen patterns that matter

This is the only part of the table you need to memorise. Every longer conversion is these sixteen patterns joined together, because each hex digit maps to exactly four bits and never interferes with its neighbours.

HexDecimalBinaryOctal
0000000
1100011
2200102
3300113
4401004
5501015
6601106
7701117
88100010
99100111
A10101012
B11101113
C12110014
D13110115
E14111016
F15111117
Why four bits

Sixteen is 24. One hex digit therefore holds exactly one nibble, one byte is always two hex digits, and a 32-bit register is always eight. Hex became the standard notation for bit patterns precisely because that alignment is exact.

Bit positions in a byte

Bits are numbered from the right starting at zero, and each position doubles.

BitValueHexIn a byte
712880Sign bit if signed
66440
53220The ASCII case bit
41610
3808Top of the low nibble
2404
1202
0101Least significant bit

Any single bit is therefore a hex value with exactly one non-zero digit, which is why bit masks are so readable in hex and so unreadable in decimal.

Masks worth recognising

HexBinarySelects
010000 0001The lowest bit only
0F0000 1111The low nibble
F01111 0000The high nibble
3F0011 1111The low six bits
7F0111 1111Everything but the sign bit
801000 0000The sign bit only
AA1010 1010Alternating, starting high
550101 0101Alternating, starting low
FF1111 1111Every bit

AA and 55 are worth knowing on sight: they are the standard alternating test patterns for memory and bus checks, because between them they exercise every bit in both states.

Full table: 00 to FF in eight-bit binary

HexBinaryDecimal
00000000000
01000000011
02000000102
03000000113
04000001004
05000001015
06000001106
07000001117
08000010008
09000010019
0A0000101010
0B0000101111
0C0000110012
0D0000110113
0E0000111014
0F0000111115
100001000016
110001000117
120001001018
130001001119
140001010020
150001010121
160001011022
170001011123
180001100024
190001100125
1A0001101026
1B0001101127
1C0001110028
1D0001110129
1E0001111030
1F0001111131
200010000032
210010000133
220010001034
230010001135
240010010036
250010010137
260010011038
270010011139
280010100040
290010100141
2A0010101042
2B0010101143
2C0010110044
2D0010110145
2E0010111046
2F0010111147
300011000048
310011000149
320011001050
330011001151
340011010052
350011010153
360011011054
370011011155
380011100056
390011100157
3A0011101058
3B0011101159
3C0011110060
3D0011110161
3E0011111062
3F0011111163
400100000064
410100000165
420100001066
430100001167
440100010068
450100010169
460100011070
470100011171
480100100072
490100100173
4A0100101074
4B0100101175
4C0100110076
4D0100110177
4E0100111078
4F0100111179
500101000080
510101000181
520101001082
530101001183
540101010084
550101010185
560101011086
570101011187
580101100088
590101100189
5A0101101090
5B0101101191
5C0101110092
5D0101110193
5E0101111094
5F0101111195
600110000096
610110000197
620110001098
630110001199
6401100100100
6501100101101
6601100110102
6701100111103
6801101000104
6901101001105
6A01101010106
6B01101011107
6C01101100108
6D01101101109
6E01101110110
6F01101111111
7001110000112
7101110001113
7201110010114
7301110011115
7401110100116
7501110101117
7601110110118
7701110111119
7801111000120
7901111001121
7A01111010122
7B01111011123
7C01111100124
7D01111101125
7E01111110126
7F01111111127
8010000000128
8110000001129
8210000010130
8310000011131
8410000100132
8510000101133
8610000110134
8710000111135
8810001000136
8910001001137
8A10001010138
8B10001011139
8C10001100140
8D10001101141
8E10001110142
8F10001111143
9010010000144
9110010001145
9210010010146
9310010011147
9410010100148
9510010101149
9610010110150
9710010111151
9810011000152
9910011001153
9A10011010154
9B10011011155
9C10011100156
9D10011101157
9E10011110158
9F10011111159
A010100000160
A110100001161
A210100010162
A310100011163
A410100100164
A510100101165
A610100110166
A710100111167
A810101000168
A910101001169
AA10101010170
AB10101011171
AC10101100172
AD10101101173
AE10101110174
AF10101111175
B010110000176
B110110001177
B210110010178
B310110011179
B410110100180
B510110101181
B610110110182
B710110111183
B810111000184
B910111001185
BA10111010186
BB10111011187
BC10111100188
BD10111101189
BE10111110190
BF10111111191
C011000000192
C111000001193
C211000010194
C311000011195
C411000100196
C511000101197
C611000110198
C711000111199
C811001000200
C911001001201
CA11001010202
CB11001011203
CC11001100204
CD11001101205
CE11001110206
CF11001111207
D011010000208
D111010001209
D211010010210
D311010011211
D411010100212
D511010101213
D611010110214
D711010111215
D811011000216
D911011001217
DA11011010218
DB11011011219
DC11011100220
DD11011101221
DE11011110222
DF11011111223
E011100000224
E111100001225
E211100010226
E311100011227
E411100100228
E511100101229
E611100110230
E711100111231
E811101000232
E911101001233
EA11101010234
EB11101011235
EC11101100236
ED11101101237
EE11101110238
EF11101111239
F011110000240
F111110001241
F211110010242
F311110011243
F411110100244
F511110101245
F611110110246
F711110111247
F811111000248
F911111001249
FA11111010250
FB11111011251
FC11111100252
FD11111101253
FE11111110254
FF11111111255

Converting by hand

C0DE

  C → 1100
  0 → 0000
  D → 1101
  E → 1110

  → 1100 0000 1101 1110

Keep every leading zero. A hex digit always contributes four bits, and dropping a zero inside the number shifts everything after it. Use the hex to binary converter for anything long enough to lose your place in.

Frequently asked questions

How many bits is one hex digit?

Exactly four, called a nibble. Two hex digits make one eight-bit byte.

What is F in binary?

1111. All four bits of the nibble are set.

What is FF in binary?

1111 1111. Every bit in the byte is set.

Why keep leading zeros?

Each hex digit must contribute four bits. Dropping a zero inside a number shifts every bit to its right and changes the value.

What are AA and 55 used for?

They are alternating bit patterns, 10101010 and 01010101, used as memory and bus test values because together they exercise every bit in both states.

How do I write a bit mask in hex?

Each bit position is a power of two: bit 0 is 01, bit 3 is 08, bit 7 is 80. Combine them by adding.