Base Converter
Instantly convert numbers between Binary, Octal, Decimal, and Hexadecimal. Free, fast, and secure online Base Converter tool for developers and students.
Formula
Decimal = sum of (digit x base^position) | Target base = repeated division by that base, reading remainders bottom to top
Changing number base is a re-notation, not a unit conversion, so no multiplying factor is involved. To read a number out of any base, multiply each digit by the base raised to its position index counting from zero on the right and add the products: hexadecimal 1A is 1 x 16 + 10 = 26 in decimal. To write a decimal number into a target base, divide repeatedly by that base and read the remainders from last to first: 26 divided by 2 gives remainders 0, 1, 0, 1, 1, so 26 is 11010 in binary. Because 16 and 8 are both powers of 2, binary regroups straight into hexadecimal four bits at a time and into octal three bits at a time with no arithmetic at all.
Worked Examples
Example 1: Convert Decimal to Binary
Problem:Convert the decimal number 10 to binary.
Solution:10 ÷ 2 = 5 remainder 0 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1 Read remainders bottom-up: 1010
Result:1010
Example 2: Convert Hex to Decimal
Problem:Convert Hex 'FF' to Decimal.
Solution:F = 15 (15 × 16^1) + (15 × 16^0) = (15 × 16) + (15 × 1) = 240 + 15 = 255
Result:255
Example 3: Convert Binary to Octal
Problem:Convert Binary 110101 to Octal.
Solution:Group bits by 3 from right: 110 101 110 (binary) = 6 (decimal) 101 (binary) = 5 (decimal) Combine: 65
Result:65
Frequently Asked Questions
What are number bases?
A number base (radix) is the number of unique digits used to represent numbers. Decimal is base 10 (0-9), Binary is base 2 (0-1), Octal is base 8 (0-7), and Hexadecimal is base 16 (0-9, A-F).
Why do computers use binary?
Computers use binary (base 2) because it maps directly to the physical state of transistors: on (1) or off (0). It is the most reliable way to store and process data electronically.
What is Hexadecimal used for?
Hexadecimal (base 16) is used to represent binary data in a more human-readable format. One hex digit represents exactly 4 binary bits (a nibble). It's commonly used for color codes (#FF5733) and memory addresses.
How to convert binary to decimal?
Multiply each bit by 2 raised to the power of its position (from right, starting at 0). For 101: (1×2^2) + (0×2^1) + (1×2^0) = 4 + 0 + 1 = 5.
What is Octal used for?
Octal (base 8) was popular in early computing (like the PDP-8) and is still used in Unix/Linux file permissions (e.g., chmod 755). Each octal digit represents exactly 3 bits.
Why are letters used in Hexadecimal?
Base 16 needs 16 digits. We use 0-9 for the first ten, then A=10, B=11, C=12, D=13, E=14, F=15. This allows representing values up to 15 with a single character.
What is the maximum value of 8 bits (1 byte)?
The maximum value is 255 (binary 11111111, hex FF). Including 0, a byte can represent 256 unique values.
Can bases have fractional parts?
Yes. In binary, digits to the right of the 'binary point' represent halves, quarters, eighths (2^-1, 2^-2, 2^-3), just as decimal decimals represent tenths and hundredths.
Is base 64 a number system?
Yes, Base64 uses 64 unique characters (A-Z, a-z, 0-9, +, /) to encode binary data into text. It is widely used for email attachments and embedding images in web pages.
Background & Theory
Understanding number bases is fundamental to computer science. A 'base' or 'radix' determines how many unique digits are available to represent values.
Common Bases:
| Base | Name | Digits | Use Case |
|---|---|---|---|
| 2 | Binary | 0, 1 | Machine code, logic gates |
| 8 | Octal | 0-7 | Unix permissions, legacy computing |
| 10 | Decimal | 0-9 | Human arithmetic |
| 16 | Hexadecimal | 0-9, A-F | Color codes, memory addresses |
How Positional Notation Works:
The value of a digit depends on its position.
In Decimal 123:
(1 × 100) + (2 × 10) + (3 × 1)
In Binary 101:
(1 × 4) + (0 × 2) + (1 × 1) = 5 (Decimal)
Hexadecimal Mapping:
| Hex | Decimal | Binary |
|---|---|---|
| 0-9 | 0-9 | 0000-1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |