Whole numbers of any size. Prefixes like 0b, 0o and 0x, and spaces between digits, are ignored. Bases above 10 use the letters A to Z as digits.

Decimal255
Binary1111 1111
Octal377
HexadecimalFF
Base 3100110
Size8 bits

How number bases work

In decimal (base 10) each digit is worth ten times the one to its right. In binary (base 2) it's twice, using only 0 and 1; in octal (base 8) eight times, using 0 to 7; and in hexadecimal (base 16) sixteen times, using 0 to 9 and then A to F for 10 to 15. One hex digit is exactly four binary digits, and one octal digit three, which is why they're used as shorthand for binary.

DecimalBinaryOctalHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Powers of two

PowerDecimalBinaryHex
20111
212102
2241004
23810008
24161000010
253210000020
2664100000040
271281000000080
28256100000000100
295121000000000200
2101,02410000000000400
2112,048100000000000800
2124,09610000000000001000
2138,192100000000000002000
21416,3841000000000000004000
21532,76810000000000000008000
21665,5361000000000000000010000

A byte is 8 bits, so it holds 0 to 255 (11111111, FF). Two bytes hold up to 65,535 (FFFF).

Numbers in binary

Frequently asked questions

How do you convert decimal to binary?

Divide the number by 2 again and again, writing down each remainder (0 or 1), until you reach 0. Read the remainders from the last to the first: that's the number in binary. 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, so 13 is 1101.

How do you convert binary to decimal?

Each digit is worth twice the one to its right: 1, 2, 4, 8, 16 and so on from the right. Add up the place values where there's a 1. 1101 is 8 + 4 + 0 + 1 = 13.

How do you convert binary to hexadecimal?

Split the binary number into groups of 4 digits from the right, and write each group as one hex digit (0000 = 0 up to 1111 = F). 1111 1111 is FF; 1 0000 0000 is 100.

What is hexadecimal used for?

Base 16 packs 4 binary digits into each hex digit, so it's a short way to write binary: colours on the web (#FF8800), memory addresses and byte values are all written in hex.

What is octal?

Base 8, using the digits 0 to 7. Each octal digit stands for 3 binary digits. It's used for file permissions on Unix and Linux (chmod 755).

Embed this calculator on your website

Free to use. Paste this into your page's HTML; please keep the link underneath.

Related calculators