Number Base Converter
Convert whole numbers between binary, octal, decimal and hexadecimal, with a table of common values and notes on bits, bytes and register addresses.
Common values
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 4 | 100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1000 | 1111101000 | 1750 | 3E8 |
| 4095 | 111111111111 | 7777 | FFF |
| 65535 | 1111111111111111 | 177777 | FFFF |
Prefixes and digits
Binary uses the digits 0 and 1 and is often written with the prefix 0b. Octal uses 0 to 7 and the prefix 0o. Hexadecimal uses 0 to 9 and A to F and the prefix 0x. The converter accepts these prefixes, spaces and underscores in the value.
Why engineers use hexadecimal
One hexadecimal digit stands for exactly four bits, so one byte is two hex digits. That is why register addresses, colour codes and protocol frames are written in hex. For example, 0xFF is 255, the largest value that fits in one byte.
Frequently asked questions
How do I convert binary to decimal?
Add the place values of each 1 bit. For 1011, that is 8 + 0 + 2 + 1 = 11. Select binary in the Base list above and the converter does it for you.
How do I convert decimal to hexadecimal?
Divide by 16 repeatedly and read the remainders from last to first, using A to F for 10 to 15. For example, 255 gives 15 and 15, which is FF.
Does it handle negative numbers and fractions?
It handles whole numbers with an optional minus sign. It does not show two's complement and does not convert fractions.
Related
Scientific Notation ConverterDMS to Decimal DegreesdBm to WattsConversion Centre