Skip to content

Number base converter

Convert between binary, octal, decimal, hex and any base up to 36.

Updated

Convert from
Binary (0b)
1111 1111
Octal (0o)
377
Decimal
255
Hexadecimal (0x)
00ff

8 bits

How to convert between bases

  1. Choose the base your number is written in: decimal, binary, octal, hex or any base from 2 to 36.
  2. Type or paste the number. Prefixes like 0x and separators like _ are fine.
  3. Read it in every other base at once, grouped for readability.
  4. Copy the one you need.

Decimal, binary, octal and hex from 0 to 16

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

Why programmers use hexadecimal

One hex digit is exactly four binary digits, so a byte is always two hex digits: 11111111 in binary is ff in hex. That makes hex a compact, readable way to write memory addresses, colors (#3b82f6) and binary data.

Common uses

  • Hex values in logs and dumps. Convert memory addresses, error codes and byte values shown in hex into decimal, or back again, while debugging.
  • Unix file permissions. Permissions such as 755 are octal. Convert them to binary to see exactly which read, write and execute bits are set.
  • Checking homework answers. Work out a binary, octal or hex conversion by hand, then type the number in to check your answer in every base at once.
  • Reading bit flags. Convert a flag value or register to binary with Group digits on, so you can see at a glance which bits are set.

Questions

How do I convert binary to decimal?

Each binary digit is worth twice the one to its right: 1, 2, 4, 8 and so on. Add up the values of the 1s. For example 1011 is 8 + 2 + 1 = 11. Type any binary number above to see it in every base.

Is there a limit on how big a number can be?

No practical limit. The converter uses arbitrary-precision integers, so even 256-bit values like cryptographic keys convert exactly, digit for digit.

What do the 0b, 0o and 0x prefixes mean?

They're how programming languages mark binary (0b), octal (0o) and hexadecimal (0x) numbers. You can paste numbers with or without them.

Can I convert fractions or negative numbers?

Negative whole numbers, yes: they keep their minus sign. Fractions aren't supported, because most fractions can't be written exactly in other bases.

All converters →