dash–calculator

04 Numbers and Counting

Decimal, Binary and Hex Conversion Table 0 to 255

Readout 04-0506 · Updated · Standard formula, shown below

Bits needed 8 bits
Hex digits needed
2 digits
Result, rounded to a whole number
Largest power of 2 not above n
128
Result, rounded to a whole number
Whole number n
181
Input
You enter
Whole number n
You get
Bits needed (bits), Hex digits needed (digits), Largest power of 2 not above n
Rounding
0 dp

This reference page provides a complete conversion table for decimal numbers from 0 to 255, along with their binary (8-bit), hexadecimal, and octal equivalents. It also includes a table of powers of 2 from 2^0 to 2^32, with hexadecimal values. These tables are essential for students learning computer science, digital electronics, and programming, as well as for professionals who need quick lookups when working with memory addresses, color codes, or network masks.

The tables allow you to see at a glance how a decimal value like 181 appears in different bases. The binary column shows the exact bit pattern, the hex column gives a compact two-digit representation, and the octal column provides a three-digit grouping. The powers of 2 table helps you understand the weight of each bit position and how hexadecimal numbers relate to binary.

Formula

A number in base b is Σ dk × bk. To convert decimal to base b, divide by b repeatedly and read the remainders from last to first. Binary uses b = 2, hexadecimal b = 16 (digits 0–9 and A–F), octal b = 8. One hex digit is exactly 4 bits, so binary converts to hex in groups of four from the right.

Worked Example

Convert 181 (the calculator default) to binary and hex.

Step Working Result
1 181 ÷ 2 = 90 r 1; 90 ÷ 2 = 45 r 0; 45 ÷ 2 = 22 r 1; 22 ÷ 2 = 11 r 0 remainders 1 0 1 0
2 11 ÷ 2 = 5 r 1; 5 ÷ 2 = 2 r 1; 2 ÷ 2 = 1 r 0; 1 ÷ 2 = 0 r 1 remainders 1 1 0 1
3 read remainders bottom-up 10110101
4 hex: 181 ÷ 16 = 11 r 5, 11 = B B5
5 bits needed 8

0 to 255 in binary (8 bits), hex and octal

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

How to read this table

To read the main table, locate the decimal number in the leftmost column. For example, find 128. The binary column shows 10000000, which means the eighth bit (from the right) is set, giving a value of 2^7. The hex column shows 80, which is 8 times 16 plus 0. The octal column shows 200, which is 2 times 64 plus 0 times 8 plus 0. Each row is independent, so you can read any decimal value directly.

Notice how the binary column always uses exactly 8 digits, with leading zeros for numbers below 128. For instance, 2 is written as 00000010, not 10. This is because a byte always has 8 bits. The hex column uses two digits, with a leading zero for numbers below 16, such as 02 for 2.

For example, 2^16 equals 65,536, which is 10000 in hex. This table is useful for converting between binary and hex quickly, as each hex digit corresponds to a group of four bits.

Powers of 2 from 2^0 to 2^32

k 2^k Hex
0 1 1
1 2 2
2 4 4
3 8 8
4 16 10
5 32 20
6 64 40
7 128 80
8 256 100
9 512 200
10 1,024 400
11 2,048 800
12 4,096 1000
13 8,192 2000
14 16,384 4000
15 32,768 8000
16 65,536 10000
17 131,072 20000
18 262,144 40000
19 524,288 80000
20 1,048,576 100000
21 2,097,152 200000
22 4,194,304 400000
23 8,388,608 800000
24 16,777,216 1000000
25 33,554,432 2000000
26 67,108,864 4000000
27 134,217,728 8000000
28 268,435,456 10000000
29 536,870,912 20000000
30 1,073,741,824 40000000
31 2,147,483,648 80000000
32 4,294,967,296 100000000

Patterns and Properties Visible in the Table

Scanning the table reveals several patterns. In the binary column, the rightmost bit alternates between 0 and 1 for every consecutive decimal number. The second bit from the right alternates every two numbers, the third every four, and so on. This reflects the place value of each bit: the rightmost bit has a value of 1 (2^0), the next has 2 (2^1), then 4 (2^2), 8 (2^3), up to 128 (2^7) for the leftmost bit in an 8-bit number.

In the hex column, the rightmost digit cycles through 0 to F (0-15) for every 16 numbers, while the leftmost digit increments by 1. For example, 16 is 10 in hex, 32 is 20, and 128 is 80. This is because each hex digit represents a group of four bits. Similarly, in the octal column, each digit represents three bits, so the rightmost digit cycles every 8 numbers, and the second digit every 64 numbers.

The powers of 2 table shows that 2^8 equals 256, which is why 255 is the largest value representable with 8 bits. Also, observe that hex numbers like 10, 20, 40, 80, and 10000 appear in the powers of 2 table, showing that powers of 2 often have simple hex representations.

These patterns help you predict values without memorizing the entire table. For instance, if you know that 251 is 11111011 in binary, you can deduce that 252 is 11111100, because adding 1 to 11111011 causes the last two bits to flip from 11 to 00 with a carry.

Method by Hand: Repeated Division

To convert a decimal number to binary, hex, or octal, use repeated division by the base. For binary, divide by 2 repeatedly, recording the remainder at each step. Continue until the quotient becomes 0. Then read the remainders from last to first to get the binary representation.

For example, convert 181 to binary. Divide 181 by 2: quotient 90, remainder 1. Then 90 by 2: quotient 45, remainder 0. Continue: 45 by 2 gives 22 remainder 1, 22 by 2 gives 11 remainder 0, 11 by 2 gives 5 remainder 1, 5 by 2 gives 2 remainder 1, 2 by 2 gives 1 remainder 0, and 1 by 2 gives 0 remainder 1. The remainders, read from last to first, are 10110101. This matches the table row for 181.

For hex, divide by 16. For 181, 181 divided by 16 gives quotient 11 and remainder 5. Since 11 is represented as B in hex, the result is B5. For octal, divide by 8. For 181, 181 divided by 8 gives 22 remainder 5, 22 divided by 8 gives 2 remainder 6, and 2 divided by 8 gives 0 remainder 2. Reading remainders from last to first gives 265, which is the octal representation.

This method works for any base. The key is to keep dividing until the quotient is zero, and then reverse the order of remainders. Always write the remainders in the order they are produced, but read them backwards.

Practical Uses of the Tables

These tables are invaluable in computing. In programming, hexadecimal is often used to represent memory addresses, color codes, and binary data. For example, the color white is often written as FFFFFF in hex, which corresponds to 255 in each of the red, green, and blue channels. The table shows that 255 is FF in hex, so you can quickly understand such codes.

In networking, IP addresses and subnet masks are often expressed in decimal, but binary is used for calculations. The table lets you convert between decimal and binary without a calculator.

In digital electronics, octal is sometimes used as a shorthand for binary because each octal digit represents three bits. This grouping is useful for reading long binary strings.

For students, these tables serve as a study aid. By examining the patterns, you can learn to convert numbers mentally. For example, knowing that 2^4 is 16, you can deduce that 16 in binary is 10000, and in hex it is 10. The powers of 2 table reinforces this relationship.

Common Mistakes and How to Avoid Them

One common mistake is dropping leading zeros. For example, the binary representation of 2 is 00000010, not 10. In an 8-bit context, the leading zeros are necessary to maintain the correct bit length. Similarly, the hex representation of 2 is 02, not just 2, when using two-digit hex. Always pad with zeros to the required width.

Another frequent error is reading remainders in the wrong order during repeated division. If you read them in the order they are produced, you get 10101101, which is incorrect. The correct answer is 10110101, which is the reverse. Always read from last to first.

When converting between binary and hex, make sure to group bits from the right, not the left. For example, the binary 10110101 can be split into 1011 and 0101. The left group 1011 is B, and the right group 0101 is 5, giving B5.

Always remember that the digits in octal are limited to 0-7, and in hex to 0-9 and A-F.

Limits and Precision of the Tables

The main table covers decimal numbers from 0 to 255, which is the range of an unsigned 8-bit integer. This is the smallest addressable unit in many computer systems, and it is the maximum value for a single byte. Numbers above 255 require more than 8 bits, so they are not included in this table. For example, 256 would be 100000000 in binary, which is 9 bits.

The table shows that 2^32 in hex is 100000000, which is a 1 followed by 8 zeros. This demonstrates how hex can represent large powers of 2 compactly.

Precision is exact for all values in the tables. There are no rounding errors because these are integer conversions. However, when using these tables for real-world applications, remember that they only give exact values for integers. If you need to convert fractional numbers, you would need a different method, such as multiplying by the base for the fractional part.

Similarly, the hex column uses two digits because 16^2 equals 256, which is just above 255.

Frequently Asked Questions

Why does the binary column always show 8 digits, even for small numbers like 2?

The table is designed for one-byte values, which always use 8 bits. Leading zeros are included to keep the width consistent, making it easier to compare bit patterns and to understand that each byte has a fixed length. For example, 2 is 00000010, not 10, because the leftmost bits are zero.

How do I convert a binary number like 10110101 to hex?

Group the bits from the right into sets of four: 1011 and 0101. Convert each group to its hex equivalent: 1011 is B, and 0101 is 5. So 10110101 is B5. This works because one hex digit represents exactly four bits.

What is the largest decimal number I can represent with 8 bits?

The largest is 255, which is 11111111 in binary, FF in hex, and 377 in octal. This is because 2^8 equals 256, so the maximum value is 256 minus 1, which is 255. The table shows this as the final row.

Why is 181 in hex B5 and not 115?

In hex, digits go from 0 to 9 and then A to F, where A is 10, B is 11, and so on. When you divide 181 by 16, you get 11 remainder 5. The quotient 11 is represented as B, so the hex number is B5. The digit 11 is not written as '11' because each hex digit is a single character.

How can I use the powers of 2 table to convert between binary and decimal?

Each bit in a binary number has a value equal to a power of 2. For example, the binary 10000000 has a 1 in the position for 2^7, which is 128. The table shows that 2^7 is 128, so you can quickly add the values of the set bits to get the decimal equivalent.

Calculators that go with this table

Method and sources

Generated with exact integer base conversion; no rounding involved.

Source formulas: the standard textbook definitions written out in the Formula section above. Every value in the tables was generated from those formulas in code and spot-checked against the worked example and the calculator on this page; nothing was copied from another table.

Related

Formula used
in n | Whole number n | - | 181 | 1 | -
out b | Bits needed | bits | floor(log2(n)) + 1 | 0
out h | Hex digits needed | digits | floor(log2(n) / 4) + 1 | 0
out p | Largest power of 2 not above n | - | pow(2, floor(log2(n))) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More on this panel

The whole Numbers and Counting panel →