Number Base Converter
Convert numbers between binary, octal, decimal and hexadecimal.
How to use the Number Base Converter
- Type the number into the Value field. It opens on 255 read as decimal.
- Set From base to the base your number is in: Binary, Octal, Decimal or Hexadecimal.
- The list underneath refreshes as you type, showing the same value in all four bases.
How the value is read before conversion
Reading runs from the left and stops at the first character that is not a digit in the chosen base, so 3.7 in decimal converts as 3. A bad first character brings up a request for a valid value.
Why hexadecimal and octal line up with bits
One hexadecimal digit stands for four bits and one octal digit for three, which is why FF is 11111111 and why Unix mode 755 is the triples 111, 101 and 101.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 255 | 11111111 | 377 | FF |
| 1024 | 10000000000 | 2000 | 400 |
Frequently asked questions
Does it handle negative numbers?
A minus sign is accepted and comes back in front of each base, so -5 shows as -101 in binary. That is sign and magnitude, not two's complement.
Where is this useful?
Reading bitwise operations, memory addresses, permission flags and hexadecimal colour codes.
Do I need the 0x prefix for hexadecimal?
No, though it is accepted. With From base on Hexadecimal, both 1F and 0x1F read as 31 in decimal, so code snippets paste in as they are.
Are hexadecimal letters case sensitive?
No. Both ff and FF read as 255, and the hexadecimal result is always shown in capitals whatever you typed.
What if I type a decimal point?
Everything from the dot onwards is dropped, so 3.7 in decimal converts as 3. Round it yourself first if the fraction matters.