Number Base Converter
Convert integers of any size between binary, octal, decimal and hexadecimal, with prefixes, signs and digit separators.
Type a number, choose the base it is written in, and read it in every common base at once.
- Binary 0b
- 1111 1111
- Octal 0o
- 377
- Decimal
- 255
- Hexadecimal 0x
- FF
How positional notation works
In base , the digits stand for
So 0xFF is . Converting to another base repeatedly divides by the new
base and collects the remainders.
Input rules
- Prefixes
0b,0oand0xare optional for their bases. - A leading
+or-sets the sign. Negative numbers are shown with a minus sign, for example-FF, not in two’s complement. - Underscores and spaces are ignored, so
1111_0000is valid. - Integers only, with no size limit (the converter uses
BigInt).
Further reading
- D. E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd ed., Addison-Wesley, 1997.