DEVELOPER TOOLS
Number Base Converter
Convert whole numbers between binary, octal, decimal, and hexadecimal, or any base from 2 to 36. Results update as you type and keep full precision for very large numbers.
Whole numbers only, up to 1,000 digits. Spaces and underscores are ignored, and prefixes such as 0x, 0b, and 0o are accepted.
Enter a number to convert it.
How to convert between number bases
- Type or paste a whole number.
- Choose the base it is written in. For anything other than 2, 8, 10, or 16, choose Other base and enter it.
- Read or copy the result in every base. With Other base, that base is shown too.
About number bases
A base sets how many digits a number system uses. Binary uses 0 and 1, octal uses 0 to 7, decimal uses 0 to 9, and hexadecimal adds a to f for the values 10 to 15. Bases above 10 continue through the alphabet, so base 36 uses 0 to 9 and a to z.
For example, 255 in decimal is 11111111 in binary, 377 in octal, and ff in hexadecimal. The status line also shows how many bits the number needs.
Negative numbers are shown with a minus sign, not as two's complement, and fractions are not supported. Calculations use arbitrary-precision integers, so long values are not rounded.
Numbers 0 to 16 in each base
Binary, octal, and hexadecimal line up neatly because 8 and 16 are powers of 2: each octal digit stands for 3 binary digits and each hexadecimal digit for 4. That is why programmers write long binary values in hexadecimal.
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | a |
| 11 | 1011 | 13 | b |
| 12 | 1100 | 14 | c |
| 13 | 1101 | 15 | d |
| 14 | 1110 | 16 | e |
| 15 | 1111 | 17 | f |
| 16 | 10000 | 20 | 10 |
Number base converter FAQ
Why does my hex value look different from a programming tool?
Some tools show negative numbers as two's complement for a fixed width, such as 32 or 64 bits. This converter shows the plain value with a minus sign instead.
Is anything I enter saved?
No. Conversion runs in this page and nothing is sent to a RandomTools application server or saved. The privacy policy describes the separate advertising script that runs on this page.
How do I convert binary to decimal by hand?
Multiply each digit by its place value and add them up. Place values double from the right: 1, 2, 4, 8, and so on. For 1011, that is 8 + 0 + 2 + 1 = 11.
How do I convert hex to binary?
Replace each hexadecimal digit with its 4-digit binary form from the table. For example, ff becomes 1111 1111, which is 255 in decimal.
What other developer tools are there?
The Base64 encoder converts text to Base64, and the hash generator creates SHA checksums.
Last updated: