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.
| Hex | Decimal | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0000 | 0 |
| 1 | 1 | 0001 | 1 |
| 2 | 2 | 0010 | 2 |
| 3 | 3 | 0011 | 3 |
| 4 | 4 | 0100 | 4 |
| 5 | 5 | 0101 | 5 |
| 6 | 6 | 0110 | 6 |
| 7 | 7 | 0111 | 7 |
| 8 | 8 | 1000 | 10 |
| 9 | 9 | 1001 | 11 |
| A | 10 | 1010 | 12 |
| B | 11 | 1011 | 13 |
| C | 12 | 1100 | 14 |
| D | 13 | 1101 | 15 |
| E | 14 | 1110 | 16 |
| F | 15 | 1111 | 17 |
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.
| Bit | Value | Hex | In a byte |
|---|---|---|---|
| 7 | 128 | 80 | Sign bit if signed |
| 6 | 64 | 40 | |
| 5 | 32 | 20 | The ASCII case bit |
| 4 | 16 | 10 | |
| 3 | 8 | 08 | Top of the low nibble |
| 2 | 4 | 04 | |
| 1 | 2 | 02 | |
| 0 | 1 | 01 | Least 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
| Hex | Binary | Selects |
|---|---|---|
| 01 | 0000 0001 | The lowest bit only |
| 0F | 0000 1111 | The low nibble |
| F0 | 1111 0000 | The high nibble |
| 3F | 0011 1111 | The low six bits |
| 7F | 0111 1111 | Everything but the sign bit |
| 80 | 1000 0000 | The sign bit only |
| AA | 1010 1010 | Alternating, starting high |
| 55 | 0101 0101 | Alternating, starting low |
| FF | 1111 1111 | Every 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
| Hex | Binary | Decimal |
|---|---|---|
| 00 | 00000000 | 0 |
| 01 | 00000001 | 1 |
| 02 | 00000010 | 2 |
| 03 | 00000011 | 3 |
| 04 | 00000100 | 4 |
| 05 | 00000101 | 5 |
| 06 | 00000110 | 6 |
| 07 | 00000111 | 7 |
| 08 | 00001000 | 8 |
| 09 | 00001001 | 9 |
| 0A | 00001010 | 10 |
| 0B | 00001011 | 11 |
| 0C | 00001100 | 12 |
| 0D | 00001101 | 13 |
| 0E | 00001110 | 14 |
| 0F | 00001111 | 15 |
| 10 | 00010000 | 16 |
| 11 | 00010001 | 17 |
| 12 | 00010010 | 18 |
| 13 | 00010011 | 19 |
| 14 | 00010100 | 20 |
| 15 | 00010101 | 21 |
| 16 | 00010110 | 22 |
| 17 | 00010111 | 23 |
| 18 | 00011000 | 24 |
| 19 | 00011001 | 25 |
| 1A | 00011010 | 26 |
| 1B | 00011011 | 27 |
| 1C | 00011100 | 28 |
| 1D | 00011101 | 29 |
| 1E | 00011110 | 30 |
| 1F | 00011111 | 31 |
| 20 | 00100000 | 32 |
| 21 | 00100001 | 33 |
| 22 | 00100010 | 34 |
| 23 | 00100011 | 35 |
| 24 | 00100100 | 36 |
| 25 | 00100101 | 37 |
| 26 | 00100110 | 38 |
| 27 | 00100111 | 39 |
| 28 | 00101000 | 40 |
| 29 | 00101001 | 41 |
| 2A | 00101010 | 42 |
| 2B | 00101011 | 43 |
| 2C | 00101100 | 44 |
| 2D | 00101101 | 45 |
| 2E | 00101110 | 46 |
| 2F | 00101111 | 47 |
| 30 | 00110000 | 48 |
| 31 | 00110001 | 49 |
| 32 | 00110010 | 50 |
| 33 | 00110011 | 51 |
| 34 | 00110100 | 52 |
| 35 | 00110101 | 53 |
| 36 | 00110110 | 54 |
| 37 | 00110111 | 55 |
| 38 | 00111000 | 56 |
| 39 | 00111001 | 57 |
| 3A | 00111010 | 58 |
| 3B | 00111011 | 59 |
| 3C | 00111100 | 60 |
| 3D | 00111101 | 61 |
| 3E | 00111110 | 62 |
| 3F | 00111111 | 63 |
| 40 | 01000000 | 64 |
| 41 | 01000001 | 65 |
| 42 | 01000010 | 66 |
| 43 | 01000011 | 67 |
| 44 | 01000100 | 68 |
| 45 | 01000101 | 69 |
| 46 | 01000110 | 70 |
| 47 | 01000111 | 71 |
| 48 | 01001000 | 72 |
| 49 | 01001001 | 73 |
| 4A | 01001010 | 74 |
| 4B | 01001011 | 75 |
| 4C | 01001100 | 76 |
| 4D | 01001101 | 77 |
| 4E | 01001110 | 78 |
| 4F | 01001111 | 79 |
| 50 | 01010000 | 80 |
| 51 | 01010001 | 81 |
| 52 | 01010010 | 82 |
| 53 | 01010011 | 83 |
| 54 | 01010100 | 84 |
| 55 | 01010101 | 85 |
| 56 | 01010110 | 86 |
| 57 | 01010111 | 87 |
| 58 | 01011000 | 88 |
| 59 | 01011001 | 89 |
| 5A | 01011010 | 90 |
| 5B | 01011011 | 91 |
| 5C | 01011100 | 92 |
| 5D | 01011101 | 93 |
| 5E | 01011110 | 94 |
| 5F | 01011111 | 95 |
| 60 | 01100000 | 96 |
| 61 | 01100001 | 97 |
| 62 | 01100010 | 98 |
| 63 | 01100011 | 99 |
| 64 | 01100100 | 100 |
| 65 | 01100101 | 101 |
| 66 | 01100110 | 102 |
| 67 | 01100111 | 103 |
| 68 | 01101000 | 104 |
| 69 | 01101001 | 105 |
| 6A | 01101010 | 106 |
| 6B | 01101011 | 107 |
| 6C | 01101100 | 108 |
| 6D | 01101101 | 109 |
| 6E | 01101110 | 110 |
| 6F | 01101111 | 111 |
| 70 | 01110000 | 112 |
| 71 | 01110001 | 113 |
| 72 | 01110010 | 114 |
| 73 | 01110011 | 115 |
| 74 | 01110100 | 116 |
| 75 | 01110101 | 117 |
| 76 | 01110110 | 118 |
| 77 | 01110111 | 119 |
| 78 | 01111000 | 120 |
| 79 | 01111001 | 121 |
| 7A | 01111010 | 122 |
| 7B | 01111011 | 123 |
| 7C | 01111100 | 124 |
| 7D | 01111101 | 125 |
| 7E | 01111110 | 126 |
| 7F | 01111111 | 127 |
| 80 | 10000000 | 128 |
| 81 | 10000001 | 129 |
| 82 | 10000010 | 130 |
| 83 | 10000011 | 131 |
| 84 | 10000100 | 132 |
| 85 | 10000101 | 133 |
| 86 | 10000110 | 134 |
| 87 | 10000111 | 135 |
| 88 | 10001000 | 136 |
| 89 | 10001001 | 137 |
| 8A | 10001010 | 138 |
| 8B | 10001011 | 139 |
| 8C | 10001100 | 140 |
| 8D | 10001101 | 141 |
| 8E | 10001110 | 142 |
| 8F | 10001111 | 143 |
| 90 | 10010000 | 144 |
| 91 | 10010001 | 145 |
| 92 | 10010010 | 146 |
| 93 | 10010011 | 147 |
| 94 | 10010100 | 148 |
| 95 | 10010101 | 149 |
| 96 | 10010110 | 150 |
| 97 | 10010111 | 151 |
| 98 | 10011000 | 152 |
| 99 | 10011001 | 153 |
| 9A | 10011010 | 154 |
| 9B | 10011011 | 155 |
| 9C | 10011100 | 156 |
| 9D | 10011101 | 157 |
| 9E | 10011110 | 158 |
| 9F | 10011111 | 159 |
| A0 | 10100000 | 160 |
| A1 | 10100001 | 161 |
| A2 | 10100010 | 162 |
| A3 | 10100011 | 163 |
| A4 | 10100100 | 164 |
| A5 | 10100101 | 165 |
| A6 | 10100110 | 166 |
| A7 | 10100111 | 167 |
| A8 | 10101000 | 168 |
| A9 | 10101001 | 169 |
| AA | 10101010 | 170 |
| AB | 10101011 | 171 |
| AC | 10101100 | 172 |
| AD | 10101101 | 173 |
| AE | 10101110 | 174 |
| AF | 10101111 | 175 |
| B0 | 10110000 | 176 |
| B1 | 10110001 | 177 |
| B2 | 10110010 | 178 |
| B3 | 10110011 | 179 |
| B4 | 10110100 | 180 |
| B5 | 10110101 | 181 |
| B6 | 10110110 | 182 |
| B7 | 10110111 | 183 |
| B8 | 10111000 | 184 |
| B9 | 10111001 | 185 |
| BA | 10111010 | 186 |
| BB | 10111011 | 187 |
| BC | 10111100 | 188 |
| BD | 10111101 | 189 |
| BE | 10111110 | 190 |
| BF | 10111111 | 191 |
| C0 | 11000000 | 192 |
| C1 | 11000001 | 193 |
| C2 | 11000010 | 194 |
| C3 | 11000011 | 195 |
| C4 | 11000100 | 196 |
| C5 | 11000101 | 197 |
| C6 | 11000110 | 198 |
| C7 | 11000111 | 199 |
| C8 | 11001000 | 200 |
| C9 | 11001001 | 201 |
| CA | 11001010 | 202 |
| CB | 11001011 | 203 |
| CC | 11001100 | 204 |
| CD | 11001101 | 205 |
| CE | 11001110 | 206 |
| CF | 11001111 | 207 |
| D0 | 11010000 | 208 |
| D1 | 11010001 | 209 |
| D2 | 11010010 | 210 |
| D3 | 11010011 | 211 |
| D4 | 11010100 | 212 |
| D5 | 11010101 | 213 |
| D6 | 11010110 | 214 |
| D7 | 11010111 | 215 |
| D8 | 11011000 | 216 |
| D9 | 11011001 | 217 |
| DA | 11011010 | 218 |
| DB | 11011011 | 219 |
| DC | 11011100 | 220 |
| DD | 11011101 | 221 |
| DE | 11011110 | 222 |
| DF | 11011111 | 223 |
| E0 | 11100000 | 224 |
| E1 | 11100001 | 225 |
| E2 | 11100010 | 226 |
| E3 | 11100011 | 227 |
| E4 | 11100100 | 228 |
| E5 | 11100101 | 229 |
| E6 | 11100110 | 230 |
| E7 | 11100111 | 231 |
| E8 | 11101000 | 232 |
| E9 | 11101001 | 233 |
| EA | 11101010 | 234 |
| EB | 11101011 | 235 |
| EC | 11101100 | 236 |
| ED | 11101101 | 237 |
| EE | 11101110 | 238 |
| EF | 11101111 | 239 |
| F0 | 11110000 | 240 |
| F1 | 11110001 | 241 |
| F2 | 11110010 | 242 |
| F3 | 11110011 | 243 |
| F4 | 11110100 | 244 |
| F5 | 11110101 | 245 |
| F6 | 11110110 | 246 |
| F7 | 11110111 | 247 |
| F8 | 11111000 | 248 |
| F9 | 11111001 | 249 |
| FA | 11111010 | 250 |
| FB | 11111011 | 251 |
| FC | 11111100 | 252 |
| FD | 11111101 | 253 |
| FE | 11111110 | 254 |
| FF | 11111111 | 255 |
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.