Number Base Converter

Convert a whole number between decimal, hexadecimal, binary, octal and any base from 2 to 36, exactly, with the working shown.

Number to convert

Up to 256 digits (2,048 characters with separators). Spaces, underscores and 0x, 0b, 0o prefixes are fine.

Results

Hexadecimal
FF
255 in decimal = FF in hexadecimal
Decimal
255
3 digits
Hex
FF
0xFF
Binary
1111 1111
8 bits
Octal
377
0o377
Base 32
7V
255 in base 32

Conversion steps

Divide 255 by 32 repeatedly and keep the remainders:

  1. 255 ÷ 32 = 7 remainder 31 (V)
  2. 7 ÷ 32 = 0 remainder 7

Read the remainders from bottom to top: 7V in base 32.

How place value works in any base

In a base BB number system, each digit is worth BB times the digit to its right. A number with digits dk…d1d0d_k \dots d_1 d_0 has the value:

N=dkBk+dk−1Bk−1+⋯+d1B1+d0B0N = d_k B^k + d_{k-1} B^{k-1} + \dots + d_1 B^1 + d_0 B^0

Each digit is between 0 and B−1B - 1. Bases above 10 use letters for the extra digits: A = 10, B = 11, and so on up to Z = 35, which is why 36 is the highest base this converter offers.

Converting out of decimal

To write a number in base BB, divide it by BB and keep the remainder. Divide the quotient again and repeat until the quotient is 0. The remainders, read from last to first, are the digits.

Worked example: 255 to hexadecimal and back

Divide 255 by 16:

Dividing 255 by 16
DivisionQuotientRemainderHex digit
255 ÷ 161515F
15 ÷ 16015F

Reading the remainders from bottom to top gives FF. To check, expand FF by place value:

FF16=15×161+15×160=240+15=255\mathrm{FF}_{16} = 15 \times 16^1 + 15 \times 16^0 = 240 + 15 = 255

In binary, each hex digit becomes four bits: F = 1111, so FF = 1111 1111, which is 8 bits or one byte.

Common number bases

Common number bases and where they are used
BaseNameDigitsWhere you see it
2Binary0, 1Hardware, bit flags, network masks
8Octal0 to 7Unix file permissions such as 755 and 644
10Decimal0 to 9Everyday counting and money
16Hexadecimal0 to 9, A to FMemory addresses, colour codes such as #4F46E5, byte dumps
32, 36Base 32, base 360 to 9, A to ZShort IDs and URL shorteners

Frequently asked questions

How do you convert hexadecimal to decimal?
Each hex digit stands for a power of 16, starting with 160 on the right. Multiply each digit by its power of 16 (A = 10, B = 11, C = 12, D = 13, E = 14, F = 15) and add the results. For example, 2F = 2 × 16 + 15 × 1 = 47.
How do you convert decimal to hexadecimal?
Divide the number by 16 and write down the remainder, turning 10 to 15 into A to F. Divide the quotient by 16 again and repeat until the quotient is 0. Reading the remainders from last to first gives the hex number.
How does converting binary to hex by grouping work?
Because 16 = 24, every group of 4 bits (a nibble) maps to exactly one hex digit, with no need to go through decimal. Binary 1101 1010 splits into 1101 = D and 1010 = A, so it is DA in hex.
Why is hexadecimal used so much in computing?
One hex digit holds exactly 4 bits, so two hex digits make one byte. That makes hex far shorter and easier to read than binary while still mapping cleanly onto memory, colour codes and machine instructions.
How large a number can this converter handle?
Up to 256 input digits, excluding prefixes and separators, within 2,048 characters total. Conversions use exact whole-number arithmetic (BigInt), without rounding. Worked steps are shown for up to 12 input digits.
Does it convert fractions or negative numbers?
No. It converts non-negative whole numbers only. For a negative number, convert its absolute value and add the minus sign back.
Esc