Number Base Converter

Convert between binary, octal, decimal, hex, base 32 and base 36 without losing precision.

Runs in your browser

Input

Input base
Bit length: 8 · Bytes needed: 1

Output

Binary (2)11111111
Octal (8)377
Decimal (10)255
Hex (16)ff
Base 327v
Base 3673

Binary, grouped by 4 bits

1111 1111
Large values are handled with BigInt, so no digits are lost to floating point rounding.

About this tool

Convert a number between the bases programmers actually use, including arbitrarily large values. Everything goes through BigInt rather than a floating point number, so values like a 64-bit hex identifier or a Twitter-style snowflake ID come out exactly right instead of having their low digits quietly rounded away.

How to use it

  1. 1Type a value and pick the base it is written in.
  2. 2Read the conversion into all six bases at once, with the binary grouped in nibbles.
  3. 3Copy the row you need, or check the bit length to see which integer type it fits.

Frequently asked questions

Why does precision matter here?

JavaScript numbers are 64-bit floating point, which can only represent integers exactly up to about 9 quadrillion. A hex colour with an alpha channel, a 64-bit hash or a snowflake ID all exceed that, and the naive conversion silently changes the last few digits — a mistake that is nearly impossible to spot by eye.

Can I paste a value with a 0x or 0b prefix?

Yes, and the prefix is stripped only when it matches the base you selected. That distinction matters: 0b101 read as a decimal number is not a prefix at all, it is an invalid character, and the tool tells you so instead of guessing what you meant.

What is the bit length for?

It tells you the smallest integer type that can hold the value, which is the practical question when you are about to store it: 8 bits fits a byte, 32 bits fits a standard integer, 64 bits needs a long. It is also bracketed with the byte count needed.

Related tools

Browse all tools