Number Base Converter

Convert numbers between binary, octal, decimal, hex and any base from 2 to 36, with BigInt precision, negative numbers and two's complement views.

About this tool

Reading a memory address in hex, checking a bitmask in binary, decoding a Unix permission in octal or shortening an ID into base 36 all mean converting the same number between bases. This tool converts between binary, octal, decimal and hexadecimal - plus any base from 2 to 36 - using BigInt, so large values stay exact instead of rounding the way a regular JavaScript number does. It also shows the two's complement form of the value at 8, 16, 32 and 64 bits. Everything runs in your browser.

How to use it

  1. Type or paste a number, and choose the base it is written in (decimal by default). Prefixes such as 0x, 0b and 0o, a leading minus sign, and spaces or underscores between digits are accepted.
  2. Read the binary, octal, decimal and hexadecimal results, each with a Copy button. Binary and hex are grouped for readability; copying removes the grouping.
  3. Pick any other base from 2 to 36 in the custom-base row to see the number in, for example, base 36 or base 32.
  4. Scroll to the two's complement section to see how the value is stored in 8, 16, 32 and 64 bits as binary and hex.

FAQ

Why does it use BigInt, and is there a size limit?

A normal JavaScript number is a 64-bit float and loses exactness above 9,007,199,254,740,991 (2^53 - 1), which breaks conversions of 64-bit values. BigInt is exact at any size, so 0xFFFFFFFFFFFFFFFF converts to 18446744073709551615 with no rounding. The only practical limit is how long a string your browser can handle.

What is two's complement?

It is how computers store signed integers: a negative number -n is stored as 2^bits - n, so -1 in 8 bits is 11111111 (FF). The two's complement section shows that stored pattern for 8, 16, 32 and 64 bits. A value is shown if it fits as either a signed or an unsigned number of that width (for 8 bits, -128 to 255); otherwise the tool tells you it does not fit.

Can I convert negative numbers?

Yes. Enter a leading minus sign and the results keep it (-255 is -FF in hex). To see the fixed-width bit pattern a CPU would store, look at the two's complement rows.

Does it handle fractions such as 0.5 in binary?

No. This tool converts integers only. Fractional values and floating-point bit layouts (IEEE 754) are a different conversion.

Which digits are allowed in each base?

Bases up to 10 use the digits 0 to base-1. Higher bases continue with letters, so hex uses 0-9 and A-F, and base 36 uses 0-9 and A-Z. Letters are not case sensitive on input, and results are shown in uppercase. If you type a digit that does not belong to the chosen base, the tool names the character instead of guessing.

Is my data sent to a server?

No. Conversion is done with BigInt arithmetic in your browser, so nothing you type leaves your device.

Related tools

Guides & comparisons

← All tools · Blog · Cheat sheets · FAQ