Number Base Converter
Convert numbers between binary, octal, decimal, hex and bases up to 36, with two's complement.
Runs in your browser Your input never leaves your device.
Report a problem with this tool
About this tool
Type one number per line and see it in every common base at once. Numbers can have a prefix (0x for hexadecimal, 0b for binary, 0o for octal) and be negative; spaces, commas and underscores inside a number are ignored, so 1_000 and 0b1010_1010 work. The tool uses arbitrary-precision integers, so values far beyond the usual 64-bit limit convert exactly, up to 5,000 digits per number and 40,000 digits in all. Choose the input base when the number has no prefix, for example hexadecimal FF. The two's complement option shows how the number is stored in 8, 16, 32 or 64 bits: the bit pattern in binary and hex, and its meaning as a signed and an unsigned number. That is the quickest way to see that 255 stored in 8 bits is -1 when read as signed, or what -42 looks like in memory. If the number does not fit in the chosen width, the tool says so. Conversions were compared with Python's int() on 300 random numbers of up to 200 bits in six bases, and the two's complement results with Python for all four widths. Everything runs in your browser; nothing is uploaded.
How to use it
- Type or paste one number per line.
- Choose the input base, or leave it automatic and use a prefix.
- Optionally pick a two's complement width.
- Read the result in every base.
Common problems
- It says a character is not a digit in the base
- Check the input base. For example 12 is not valid in binary and G is not valid in hexadecimal.
- A negative number looks different in two's complement
- That is expected: the bit pattern of a negative number is the pattern of 2^bits minus its size. The tool shows both the pattern and the signed value.
- It says the number does not fit
- A signed 8-bit number can hold -128 to 127 and an unsigned one 0 to 255. Choose a wider width.