Number Base Converter
Convert between binary, octal, decimal, hex and any base up to 36.
How to use the Number Base Converter
- 1Type a number in any base.
- 2See it in binary, octal, decimal, hex and a custom base at once.
- 3Explore two's complement and bit patterns for signed values.
About Number Base Converter
The Number Base Converter translates numbers between binary, octal, decimal and hexadecimal, plus any custom base from 2 to 36, all at once. Choose the input base or type a prefix such as 0x, 0b or 0o. Fractions work too: a value like 0.1 is converted digit by digit, with up to 24 digits after the point and a mark when the result had to be cut off. Digits can be grouped in nibbles or thousands and shown in upper or lower case, and large integers are converted exactly, without rounding.
For programmers, a two's complement section shows signed integers as 8-, 16-, 32- or 64-bit patterns; click any bit to flip it and watch the value change. An IEEE 754 panel splits a decimal number into the sign, exponent and mantissa of a single- or double-precision float and shows its hex representation and rounding error. A character panel gives code points with their UTF-8 and UTF-16 encodings.
The base converter helps with computer science homework, debugging, reading hex dumps and color codes, building bit masks and understanding why 0.1 can't be stored exactly in floating point.
Frequently asked questions
How do I convert binary to decimal?
Multiply each bit by the power of 2 for its position, counting from 0 at the right, and add the results. 1011 is 1×8 + 0×4 + 1×2 + 1×1 = 11.
How do I convert decimal to hexadecimal?
Divide by 16 repeatedly and note the remainders, using A to F for 10 to 15, then read them from last to first. 255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15, so 255 is FF in hex.
What is two's complement?
It is the standard way computers store signed integers. A negative number −x in n bits is stored as 2ⁿ − x, so in 8 bits −1 is 11111111 and −128 is 10000000. The leftmost bit is 1 for every negative number, and addition works the same way for signed and unsigned values.
Why can't 0.1 be represented exactly in binary?
0.1 is 1/10, and 10 contains the factor 5, which isn't a power of 2. In binary it becomes the endlessly repeating fraction 0.000110011…, so a float stores the nearest value it can, which is why 0.1 + 0.2 doesn't give exactly 0.3 in many programming languages.
More in Math & Science
Plot functions, find roots and intersections, and explore with sliders.
Solve linear, quadratic, polynomial and systems of equations step by step.
Multiply, invert and find determinants, eigenvalues and more.