How to use it
- Type a whole number into any box: binary, octal, decimal, hexadecimal or the custom base.
- The other boxes update as you type. Choose any base from 2 to 36 for the custom box.
- Below, see how the number is stored in binary at a chosen width, and its bytes in memory.
What it accepts
- Upper- or lower-case letters for digits above 9:
ffandFFare the same. - Prefixes that match the box:
0xfor hexadecimal,0bfor binary and0ofor octal. If you paste a prefixed number into the wrong box, the tool tells you which box it belongs in. - Spaces, commas, apostrophes and underscores between digits, so
1,000,000,1_000_000andFF FFall work. Commas are always separators, never decimal points. - A minus sign for negative numbers. Negative numbers are shown with a minus sign in every base.
Two’s complement
Computers store negative whole numbers using two’s complement: in an 8-bit value, the highest bit is worth −128 instead of +128. So the same bits can mean two numbers. 1111 1111 is 255 as an unsigned number and −1 as a signed one. Choose a width to see both readings and the range each type can hold.
Auto picks the smallest of 8, 16, 32 and 64 bits that holds your number (then whole multiples of 64). If a number is too big for the width you choose, only its lowest bits are kept, which is what happens when a value is cast to a smaller type in languages such as C, Java and Rust.
Byte order
Big-endian lists the most significant byte first, as you would write the number. This is the order used in network protocols. Little-endian lists the least significant byte first, which is how Intel, AMD and most ARM processors store numbers in memory.
Limitations
- Only whole numbers. Fractions such as
3.14and scientific notation such as1e6aren’t supported. - Numbers can have up to 10,000 digits. The byte view shows up to 64 bytes (512 bits).
- Floating-point formats, such as how 0.1 is stored in a
double, aren’t covered.
Frequently asked questions
How do I convert binary to decimal by hand?
Each binary digit is worth twice the one to its right: 1, 2, 4, 8, 16 and so on. Add up the values of the digits that are 1. For example, 1011 is 8 + 0 + 2 + 1 = 11. Hexadecimal works the same way with powers of 16, which is why each hex digit stands for exactly four binary digits.
Why is 255 shown as −1?
In 8 bits, 255 is 1111 1111. Read as an unsigned number, those bits mean 255. Read as a signed number in two’s complement, the system almost every computer uses, the highest bit counts as −128, so the same bits mean −128 + 127 = −1. The two’s complement section shows both readings, so you can see what a value becomes in a signed type such as int8_t or sbyte.
Is there a limit to how big a number can be?
Numbers can have up to 10,000 digits, which is far beyond the 64-bit limit of most programming languages. The converter uses arbitrary-precision arithmetic, so large values are exact rather than rounded, unlike many calculators and spreadsheets, which lose precision beyond about 15 to 17 significant digits.
