Number Base Converter
This number base converter translates a single value between the four bases used most often in mathematics and computing: binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). Type any number, pick the base it is written in, and the tool instantly shows its equivalent in all four systems. It is handy for programming, digital electronics, color codes, network addresses, and any homework that mixes binary and hexadecimal notation.
The conversion happens instantly as you type. Hexadecimal digits use the letters A–F and are shown in uppercase.
Binary (base 2)
Octal (base 8)
Decimal (base 10)
Hexadecimal (base 16)
Publicidad
How it works
Converting between bases means changing how a number is written without changing its value. The converter first reads what you typed in the input base and turns it into an ordinary decimal integer; then it lays that integer out in each base by dividing repeatedly and reading the remainders. The classic programming example is an 8-bit byte. The binary 11111111 is read by adding the powers of 2 that are switched on: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 in decimal. That same 255 in hexadecimal is FF, because 255 = 15×16 + 15 and the digit 15 is written F. That is why a full byte (all bits set to 1) is 255, FF in hex and the largest value an unsigned 8-bit variable can hold. If you type a digit that does not exist in the chosen base — a 2 in binary or a G in hexadecimal — the number is invalid and the converter flags it as an error.
Equivalence table: decimal, binary and hexadecimal
The first sixteen numbers (0 to 15) are the key to the whole system, because each hexadecimal digit represents exactly four bits (a nibble). Memorizing this table lets you read binary and hexadecimal values at a glance. 255 is included at the end: the largest number that fits in an 8-bit byte, and the value of each channel in a color like #FFFFFF (white).
| Decimal | Binary | Hexadecimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
| 255 | 11111111 | FF |
Publicidad
Preguntas frecuentes
- What is a number base?
- A number base, or radix, is how many distinct digits a positional system uses before it rolls over to a new place. Decimal (base 10) uses ten digits, 0–9; binary (base 2) uses only 0 and 1; octal (base 8) uses 0–7; and hexadecimal (base 16) uses 0–9 plus A–F. The same quantity looks different in each base, but its value is identical.
- Why do computers use binary and hexadecimal?
- Computers store data as electrical states that are naturally either on or off, which maps directly onto the two digits of binary. Hexadecimal is a shorthand for binary: because 16 is 2⁴, each hex digit represents exactly four binary digits, so long binary strings become short, readable hex. That is why memory addresses, color codes and byte values are usually written in hexadecimal.
- What do the letters A to F mean in hexadecimal?
- Hexadecimal needs sixteen distinct digits, but our usual notation only has ten (0–9). The letters A, B, C, D, E and F fill the gap, standing for the values 10, 11, 12, 13, 14 and 15. So the hex number FF equals 15×16 + 15 = 255 in decimal.
- How do I convert 255 to binary and hexadecimal?
- Enter 255 with the input base set to decimal (base 10). The converter shows 11111111 in binary, 377 in octal and FF in hexadecimal. It works by dividing 255 repeatedly by the target base and reading the remainders from bottom to top.
- Why does my number show an error?
- Each base only allows certain digits: binary allows 0 and 1, octal allows 0–7, decimal allows 0–9 and hexadecimal allows 0–9 and A–F. If you enter a digit that is not valid for the base you selected — such as an 8 in a binary number or a letter in a decimal one — the value cannot be interpreted, so the results show an error until you fix the input.
- What do colors like #FF5733 have to do with hexadecimal?
- Web color codes use hexadecimal: each pair of digits is a channel (red, green, blue) with a value from 0 to 255. In #FF5733, FF is 255 of red (maximum), 57 is 87 of green and 33 is 51 of blue. That is why hexadecimal is so common in design and CSS: two digits cover exactly the 256 levels of each color.
- What is the octal system and what is it used for?
- Octal (base 8) uses the digits 0 to 7 and groups bits in threes. Today it shows up mostly in Unix and Linux file permissions: a permission like 755 is octal, where each digit (7, 5, 5) describes in binary the read, write and execute permissions for a group of users.