English

Number Base Converter — Binary, Octal, Hex

Base 2/8/10/16/36 and custom base conversion with BigInt, negatives and 0x/0b/0o prefixes

Runs in your browser · nothing is uploaded

What it is

The same number is 11111111 in binary, ff in hexadecimal and 255 in decimal. Memory addresses, color codes, bit masks and Unix file modes (octal) all make you read a value in another base. Enter one number here and see it in base 2, 8, 10, 16, 36 and a base of your own choosing at once.

How to use

  1. Type a number. Spaces and _ are ignored as digit separators, so 1111_0000 is fine.
  2. Choose the input base. The default, Auto, looks for a 0x, 0b or 0o prefix and falls back to decimal.
  3. Copy the value you need from the results table. The custom row accepts any base from 2 to 36.
  4. Turn on uppercase digits if you prefer FF over ff.

How it works

  • Parsing uses BigInt. Each character is read left to right and accumulated as value = value × base + digit, so there is no size limit beyond the 20,000-character input cap.
  • Digit values come from 0-9 and the letters a-z (case-insensitive), standing for 0-9 and 10-35. That is why base 36 is the highest possible.
  • A digit value that is equal to or greater than the base is reported with its position and the digits the base allows. A 2 in binary or a 9 in octal is an error.
  • A sign (- or +) is recognised only at the very start, never after a prefix.
  • The bit count is the length of the magnitude written in binary; zero counts as one bit.

Examples

Input Base Binary Hex Decimal
255 10 11111111 ff 255
0xff Auto 11111111 ff 255
-0b101 Auto -101 -5 -5
18446744073709551617 10 1, sixty-three 0s, 1 10000000000000001 18446744073709551617

2^64+1 loses its last digit as an ordinary JavaScript number, but here it comes out exactly as 10000000000000001 in hex.

Notes

  • Octal is the base of chmod 755, hex of addresses and colors like #1e90ff, and base 36 is a compact way to write short IDs.
  • If a character that is not a digit slips in, such as a letter in decimal or a Korean character, the error tells you which position it is at.

FAQ

Are very large numbers converted exactly?

Yes. Ordinary JavaScript numbers are only exact up to 2^53, but this tool computes with arbitrary-precision integers (BigInt), so values beyond 2^64 convert without a single digit of error. Input can be up to 20,000 characters.

How are negative numbers shown?

The sign is kept and the magnitude is converted, so -255 is -ff in hex. It is not a two's-complement bit pattern; if you need one for a fixed width such as 8 bits, interpret the result yourself.

Can I type 0x or 0b prefixes?

With the input base on Auto, the prefixes 0x (hex), 0b (binary) and 0o (octal) are recognised and anything without one is decimal. If you choose a base yourself, only the matching prefix is accepted; in base 16 the text 0b1 is the digits 0, b, 1, not a prefix.

What about fractions?

Only integers are supported. A decimal point is reported as an invalid character with its position.

Missing a tool?