Skip to content
DayUtils

Number Base Converter – Binary, Octal, Decimal and Hexadecimal

Convert whole numbers between binary (base 2), octal (base 8), decimal (base 10), hexadecimal (base 16) and any base from 2 to 36. Very large numbers are converted exactly, and the result shows how many bits the number needs.

Loading tool…

How to use the number base converter

  1. Type the number.
  2. Choose the base it is written from: binary, octal, decimal, hexadecimal or another base from 2 to 36.

You’ll see the number in decimal, plus a table with binary (grouped in fours), octal, decimal, hexadecimal and base 36, and how many bits it needs.

How number bases work

In any base b, each position is worth b times the position to its right:

Value = dₙ × bⁿ + … + d₂ × b² + d₁ × b + d₀

Bases above 10 use letters for the extra digits: A = 10, B = 11 … Z = 35.

Worked examples

Binary 1101 to decimal: 1 × 8 + 1 × 4 + 0 × 2 + 1 × 1 = 13

Hex 2F to decimal: 2 × 16 + 15 = 47

Decimal 255:

BaseValue
Binary1111 1111
Octal377
Decimal255
HexadecimalFF
Base 3673

Quick conversions between binary, octal and hex

Because 8 = 2³ and 16 = 2⁴, you can convert without going through decimal:

  • Binary to hex: group the bits in fours from the right and convert each group. 1011 0110 = B6.
  • Binary to octal: group in threes. 10 110 110 = 266.
  • Hex to binary: replace each hex digit with its four bits. 3A = 0011 1010.

Where different bases are used

  • Binary (2) — how computers store everything: bits and bytes, network masks, flags.
  • Octal (8) — Unix and Linux file permissions such as chmod 755.
  • Decimal (10) — everyday counting.
  • Hexadecimal (16) — web colours (#1E90FF), memory addresses, MAC addresses, Unicode code points and hashes.
  • Base 36 — compact IDs and short URLs, because it uses all digits and letters.

Counting in binary

Binary counting works just like decimal, except you carry after 1 instead of after 9: 0, 1, 10, 11, 100, 101, 110, 111, 1000. Each extra bit doubles how many values you can represent, which is why sizes in computing come in powers of two: 8 bits give 256 values, 16 bits give 65,536 and 32 bits give over four billion.

Bits and bytes

The number of bits a value needs is the length of its binary form. One byte (8 bits) holds 0 to 255, two bytes 0 to 65,535 and four bytes 0 to 4,294,967,295. Negative numbers in computers are usually stored in two’s complement, which this converter doesn’t model; it shows negative numbers with a minus sign.

For colour codes, try the colour converter; for text encodings, Base64. For other number formats, see the scientific notation converter and the Roman numeral converter.

Frequently asked questions

How do I convert decimal to binary?

Divide the number by 2 repeatedly and write down the remainders, then read them from bottom to top. For 13: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1 → 1101.

How do I convert hex to decimal?

Multiply each digit by 16 raised to its position (counting from 0 on the right) and add. FF = 15 × 16 + 15 = 255. Letters A to F stand for 10 to 15.

What is 255 in binary and hex?

255 is 11111111 in binary (8 bits, all ones) and FF in hexadecimal — the largest value one byte can hold.

Why do programmers use hexadecimal?

Each hex digit is exactly four binary digits, so hex is a compact, readable way to write binary data such as colours (#FF8800), memory addresses and byte values.

Can I type prefixes like 0x or 0b?

Yes. 0x for hexadecimal, 0b for binary and 0o for octal are accepted when the matching base is selected. Spaces and underscores in long numbers are ignored.

How big a number can I convert?

Very big. The converter uses exact big-integer arithmetic, so numbers with dozens of digits convert without any rounding.

Last updated: