Number Base Converter: binary, octal, decimal, hexadecimal and any base from 2 to 36

Custom base

Two's complement

Bit width
Binary–
Hex–
Read as signed–
Read as unsigned–

About Number Base Converter

This tool converts a number between binary, octal, decimal, hexadecimal and any other base from 2 to 36. The five fields are linked, so typing in one fills in the rest straight away.

Numbers can be as large as your browser can hold, because the maths uses BigInt and never rounds to a 64-bit float. Negative numbers and fractions such as 0.1 or 101.1 work in every base.

The two's complement panel shows how a whole number is stored in 8, 16, 32 or 64 bits, with the bit pattern in binary and hex and how that pattern reads as signed and unsigned.

Everything is calculated in your browser, so nothing is uploaded.

How to use it

  1. Type or paste a number into any field. Spaces, commas and underscores are ignored, and a matching prefix such as 0x, 0b or 0o is accepted.
  2. Pick a base from 2 to 36 in the Custom base menu to see the number in that base, for example base 32 or base 36.
  3. Use the checkboxes to switch between upper and lower case, group digits for easier reading and add 0b, 0o or 0x prefixes to the output.
  4. Choose a bit width under Two's complement to see how the number is stored, then copy any row.

Frequently asked questions

How do I convert decimal to binary?

Type the decimal number into the Decimal field and read the Binary field. The tool repeatedly divides by 2 for you, so 255 becomes 11111111 and -255 becomes -11111111. Tick Group digits to split the bits into groups of four.

What do the prefixes 0x, 0b and 0o mean?

They mark the base of a number in code: 0x for hexadecimal, 0b for binary and 0o for octal. A matching prefix is accepted in each field, and Show prefixes adds them to the output. If you type 0x in the wrong field, the tool tells you which field it belongs in.

What is two's complement?

It is the way computers store negative whole numbers in a fixed number of bits. To get it, invert every bit of the positive value and add 1, so -1 in 8 bits is 11111111. The same bits read as unsigned mean 255, which is why the panel shows both readings. A number that does not fit the chosen width is flagged and shown wrapped to its lowest bits.

How big a number can I convert?

There is no fixed limit on digits, only up to 200,000 characters per field and the memory of your device. Integers are handled with BigInt, so a 100-digit number converts exactly, without the rounding a normal JavaScript number would give.

Can it convert fractions?

Yes. 0.5 in decimal is 0.1 in binary, and 101.1 in binary is 5.5 in decimal. Some fractions repeat forever in another base, such as 0.1 in binary. Those are cut after 32 digits and the tool says so.

What are the digits in bases above 10?

After 0 to 9 the letters a to z stand for 10 to 35, so base 36 uses all of them. Letters are accepted in either case, and the Uppercase letters checkbox decides how the output looks.

Is anything uploaded?

No. The conversion runs in your browser, and nothing you type is sent or stored.