Number Base Converter

Type a number in any field — binary, octal, decimal, hex or a custom base — and every other field updates instantly.

Loading tool…

About the Number Base Converter

Every field is live: edit the binary, octal, decimal, hexadecimal or custom-base value and the others follow. The converter uses JavaScript BigInt, so values are not limited to 253 like ordinary JavaScript numbers — you can paste a 256-bit hash in hex and get its exact decimal value. Prefixes 0b, 0o and 0x, underscores and spaces are accepted, so literals copied from code (0xDEAD_BEEF) work as they are.

The custom base goes up to 36, using the digits 0–9 then a–z; this matches Number.prototype.toString(radix) and parseInt(s, radix) in JavaScript and int(s, base) in Python. Base 36 is a common choice for short IDs because it is the most compact case-insensitive alphanumeric encoding. The bit view groups the binary value into nibbles and bytes and shows how many bytes it needs.

The two's complement table answers the question “what are these bits as a signed or unsigned integer?”. A negative number is stored as 2n + value, so −1 is FF in 8 bits and FFFFFFFF in 32 bits. For a positive input the table shows how the same bit pattern reads as a signed type — 200 in a signed byte (int8, Java byte) becomes −56. This is exactly what happens when a C or Java program casts between signed and unsigned types.

How to use it

  1. Type or paste a number into the field for its base (prefixes like 0x are fine).
  2. Read the value in all other bases; pick any base from 2 to 36 for the custom field.
  3. Check the grouped bits and the two's complement table for 8, 16, 32 and 64 bits.
  4. Click Copy next to the value you need.

Frequently asked questions

How large a number can I convert?
There is no practical limit — the tool uses arbitrary-precision BigInt, so values of hundreds of digits convert exactly.
How do I represent a negative number in binary?
Computers use two's complement: invert all bits of the positive value and add 1, within a fixed width. −5 in 8 bits is 11111011 (0xFB). The two's complement table does this for 8, 16, 32 and 64 bits.
What digits does base 36 use?
0–9 for values 0–9 and the letters a–z for 10–35. Letters are case-insensitive, so ZZ and zz are both 1295.
Why does JavaScript's parseInt give wrong results for big hex numbers?
parseInt returns a double-precision Number, which is exact only up to 2^53 − 1 (9,007,199,254,740,991). Use BigInt('0x' + hex) for larger values, as this tool does.

Related tools