This number base converter rewrites a whole number in another positional system: binary (base 2), octal (base 8), decimal (base 10) or hexadecimal (base 16). The number base converter uses this formula: Value = sum of digit × base^position; convert the integer by repeated division. The value does not change, only the way it is written. For example, decimal 255 is 11111111 in binary, 377 in octal and FF in hex.
On this page

How to use the number base converter
- Enter the number using digits valid for its base (0–1 for binary, 0–7 for octal, 0–9 and A–F for hex).
- Choose the base it is written in and the base you want.
- Read the result. Hex letters are case-insensitive: ff and FF are the same value.
The methods below show decimal to binary and the other conversions step by step, so you can check any number base converter result by hand.
Conversion method: any base to decimal
Multiply each digit by the base raised to its position, counting from 0 on the right, then add the results.
Example: binary 1011 = 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 = 8 + 0 + 2 + 1 = 11.
Example: hex 7EA = 7 × 162 + 14 × 16 + 10 = 1,792 + 224 + 10 = 2,026.
Conversion method: decimal to another base
Divide by the target base repeatedly and write down the remainders. Read the remainders from last to first.
Example: decimal 2,026 to octal: 2,026 ÷ 8 = 253 r 2; 253 ÷ 8 = 31 r 5; 31 ÷ 8 = 3 r 7; 3 ÷ 8 = 0 r 3. Reading upward gives 3752.
Binary to hex shortcut
Each hex digit is exactly four binary digits (bits), and each octal digit is three. Group the bits from the right: binary 11111101010 → 0111 1110 1010 → 7 E A → hex 7EA.
Number base comparison table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
Where each base is used
- Binary: how computers store data; each digit is one bit.
- Hexadecimal: compact notation for bytes (two hex digits per byte), used for memory addresses and web colors such as #FF8800.
- Octal: Unix file permissions, for example chmod 755.
- Decimal: everyday counting.
Powers of two in binary and hex
Each binary place is a power of two, which is why these values show up in memory sizes and data limits. A byte holds 28 = 256 values (0 to 255):
| Power | Decimal | Binary | Hex |
|---|---|---|---|
| 20 | 1 | 1 | 1 |
| 21 | 2 | 10 | 2 |
| 24 | 16 | 10000 | 10 |
| 27 | 128 | 10000000 | 80 |
| 28 | 256 | 100000000 | 100 |
| 210 | 1,024 | 10000000000 | 400 |
| 212 | 4,096 | 1000000000000 | 1000 |
| 215 | 32,768 | 1000000000000000 | 8000 |
| 216 | 65,536 | 10000000000000000 | 10000 |
Binary to decimal is easiest with this table: add the powers of two wherever a 1 appears.
Hex color codes
Web colors use three bytes written as six hex digits: red, green, blue. #FF8800 splits into FF, 88 and 00, which in decimal is rgb(255, 136, 0). Hex to decimal for each pair is first digit × 16 + second digit, so 88 = 8 × 16 + 8 = 136. Decimal to hex reverses it: 200 = 12 × 16 + 8 = C8. For byte and kilobyte sizes, see the data storage converter.
Negative numbers and file permissions
Computers usually store negative integers as two’s complement, which a number base converter does not apply automatically. To write −5 in 8 bits, write 5 in binary (00000101), flip every bit (11111010) and add one (11111011). In hex that is FB. The number base converter treats input as an unsigned value, so FB converts to 251; read it as −5 only when you know the value is a signed 8-bit number.
Octal still appears in Unix file permissions, and the number base converter is handy there too. In chmod 755, each digit is three bits: 7 is 111 (read, write, execute), 5 is 101 (read and execute). So 755 means rwxr-xr-x. The number base converter shows 755 octal as 111101101 in binary, which lines up with the permission letters.
Related converters and calculators
Other tools for numbers and data:
- Binary converter: binary arithmetic
- Hex converter: hex arithmetic
- Roman numeral converter: I, V, X and more
- Data storage converter: bits and bytes
- Base64 encoder and decoder: text encoding
- Scientific calculator: general math
Sources
Python documentation: int() with a base; W3C CSS Color Module Level 4: hex notation.
Questions about this calculator
How do I convert binary to decimal?
Multiply each bit by 2 raised to its position, counting from 0 on the right, and add. 1011 = 8 + 0 + 2 + 1 = 11.
How do I convert decimal to binary?
Divide by 2 repeatedly and record the remainders, then read them from last to first. 13 → 1101.
How do I convert hex to decimal?
Multiply each hex digit (A=10 to F=15) by 16 raised to its position and add. 2F = 2 × 16 + 15 = 47.
How do I convert decimal to hex?
Divide by 16 repeatedly and write the remainders as hex digits, last first. 255 → FF.
Why do programmers use hexadecimal?
One hex digit is exactly four bits, so two hex digits describe one byte. That makes long binary values much shorter to read and write.
What does 0x mean before a number?
0x is a prefix used in C, Python and many other languages to mark a hexadecimal number. 0b marks binary and 0o marks octal in Python.
Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.
Report a calculation issue