More
More
Number Base Converter
Binary, octal, decimal and hex.
Free tools that run in your browser. Nothing you type, open or create is uploaded to NerdBible or anyone else.
Two's complement
How the number is stored in a fixed number of bits. Negative numbers use two's complement; a bit pattern can also be read back as signed or unsigned.
| Bits | Binary | Hex | As signed | As unsigned |
|---|
Numbers of any size are handled exactly with BigInt, so a 128 bit value converts without rounding. Prefixes 0x, 0b and 0o are understood, and spaces and underscores between digits are ignored. Whole numbers only.
How to use it
- Type a number and choose the base it is written in, or paste one with a 0x, 0b or 0o prefix.
- Read it in binary, octal, decimal, hex and any base from 2 to 36.
- Check the two's complement table to see how it is stored in 8, 16, 32 or 64 bits.
Questions
How do I convert binary to decimal by hand?
Each digit is worth twice the one to its right: 1, 2, 4, 8 and so on. Add up the values of the digits that are 1. For 1011 that is 8 + 2 + 1 = 11.
What is two's complement?
The way computers store negative whole numbers. To negate a number, flip every bit and add one. In 8 bits, -1 is 11111111 and -128 is 10000000, which is why a signed byte runs from -128 to 127.
Why do hex numbers use letters?
Base 16 needs sixteen digits, so after 0 to 9 it uses A to F for 10 to 15. One hex digit is exactly four bits, which makes hex a compact way to write binary.
What is the largest number it can convert?
There is no fixed limit: BigInt grows as needed. Very long numbers of many thousands of digits just take a little longer.
About this tool
About the number base converter
Computers think in binary, programmers write in hex, and people count in decimal. Type a number in any base and see it in all the others at once: binary, octal, decimal, hexadecimal and any base from 2 to 36.
Input that just works
- Prefixes 0x, 0b and 0o are recognised, so you can paste straight from code.
- Spaces and underscores between digits are ignored, so 1111_0000 is fine.
- Numbers of any size convert exactly using BigInt, so a 128-bit value is never rounded.
Whole numbers only; fractions are not converted.
Two's complement
A table shows how the number is stored in 8, 16, 32 and 64 bits. Computers store negative whole numbers by flipping every bit and adding one, which is why a signed byte runs from -128 to 127 and why -1 is all ones.
Converting by hand
In binary each digit is worth twice the one to its right: 1, 2, 4, 8 and so on. Add the values of the digits that are 1: 1011 is 8 + 2 + 1, which is 11. Hex uses A to F for 10 to 15, and one hex digit is exactly four bits, which is why it is a compact way to write binary.
Everything is calculated in your browser.
Related tools
- Chmod CalculatorUnix file permissions in numbers and letters.
- IP Subnet CalculatorCIDR ranges, masks and host counts.
- Colour ConverterHEX, RGB, HSL and OKLCH.
- Base64 Encode & DecodeEncode and decode Base64 text.
- Unit ConverterLength, weight, temperature, data and more.