Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

Number Base Converter

Ready
Runs in your browser. Nothing you paste is uploaded unless you share it.

Convert numbers between binary, octal, decimal, hex and bases 2 to 36, exact up to 5,000 digits, with the steps

Type a number in a base from 2 to 36 and read it in binary, octal, decimal and hex at once, exact up to 5,000 digits, with its bits at the width you pick.

How to use it

  1. Type or paste a number. 0x, 0b and 0o say its base; digits alone are read as decimal, letters a–f as hex. Or pick the base in From.
  2. Pick the base to show first in To, or leave Auto: decimal, or hex when you typed decimal.
  3. Read every base at once below it, the bits at 8 to 128 bits, and the steps by hand. Copy takes a row’s digits.

Examples

A hex value, every base at once

Input
0xFF
Result
Decimal  255
Hex      0xff
Octal    0o377
Binary   0b1111 1111

A negative number as 8-bit two’s complement

Input
-42
Result
Bits      1101 0110
Hex       0xd6
Unsigned  214
Signed    -42

Bits: 8. The same 8 bits read as unsigned are 214 (256 − 42).

A fraction that repeats in binary

Input
0.1
Result
0.0(0011)

To: Binary. The part in brackets repeats without end, which is why 0.1 can’t be stored exactly as a binary float.

How the base is found

With From on Auto, the number says its own base the way code writes it. Pick From to read it another way: 10 is ten in decimal, two in binary and sixteen in hex.

You typeRead asWhy
0xFF, 0XFFhexthe 0x prefix (C, JavaScript, Python, Go)
0b1010binarythe 0b prefix
0o755octalthe 0o prefix (Python, JavaScript)
ff, 7fffffffhexit has the letters a–f
255, 1,000,000decimaldigits only; commas are dropped
1111_1111, 1111 1111as abovespaces, _ and ' between digits are dropped

Big numbers stay exact

JavaScript numbers hold integers exactly only up to 9,007,199,254,740,991 (2⁵³ − 1); past that, a converter built on them rounds the last digits without saying so. This page works on the digits themselves, so a 128-bit ID, a 256-bit hash or a 5,000-digit number comes out exact in each base.

Bases above 16

Choose Other base to read or write any base from 2 to 36. Digits go 0–9, then a–z: in base 36, z is 35 and 10 is 36. Base 32 and base 36 are common in short IDs and URLs.

Questions

How do I convert a negative number to binary?
Computers store negative integers as two’s complement: invert every bit of the positive number at a fixed width, then add 1. Pick the width in Bits; -1 is 1111 1111 in 8 bits and FFFFFFFF in 32. The page shows both readings of the same bits, signed and unsigned.
Why does a fraction never end in binary?
A fraction ends in a base only when its denominator divides a power of that base. 0.1 is 1/10, and no power of 2 is a multiple of 5, so in binary it repeats: 0.0(0011). The page shows the repeating part in brackets, or the first 64 digits when the repeat is longer; Places sets how many (1 to 1,024).
Does it keep every digit of a very long number?
Yes, up to 5,000 digits. The headline names the digit count when the number is too long to read in one line; every row below holds the whole number and Copy takes all of it.
Is the number I type uploaded?
No. Everything runs in your browser, so your numbers stay on your device. Nothing you paste is uploaded unless you share it.

Related tools