Base Converter
Converting 0xFF to binary or 1011₂ to decimal is quick once you see the method. This base converter handles whole numbers of any length (using exact big-integer arithmetic), fractions, and negative numbers in two’s complement, and shows the repeated-division and place-value steps so you can check homework or understand what your code is doing.
Base converter
Working
Number Base Practice Pack
Printable number base reference and practice: hex/binary/octal table, powers of two chart, two’s complement card and conversion worksheets with answer keys.
- Conversion table (PDF/XLSX)
- Powers of two (PDF)
- Two’s complement card (PDF)
- Worksheets (PDF/DOCX)
Formats: PDF, XLSX, DOCX. Instant download after payment (link valid 72 hours, up to 5 downloads). AI-assisted: the templates were drafted with AI help and reviewed and laid out by Kedop.
$3.00 USD, one-time
Secure card checkout by Stripe. Full refund within 7 days — see the refund policy and license.
How number bases work
In base b, each position is worth b times the position to its right. In decimal (base 10), 347 means 3 × 100 + 4 × 10 + 7 × 1. In binary (base 2), 1011 means 1 × 8 + 0 × 4 + 1 × 2 + 1 × 1 = 11. Bases above 10 need extra digit symbols, so hexadecimal uses A–F for 10–15, and bases up to 36 use the whole alphabet.
Converting to decimal: place value
| Number | Expansion | Decimal |
|---|---|---|
| 1011₂ | 1·8 + 0·4 + 1·2 + 1·1 | 11 |
| 777₈ | 7·64 + 7·8 + 7·1 | 511 |
| FF₁₆ | 15·16 + 15·1 | 255 |
| 1A3₁₆ | 1·256 + 10·16 + 3·1 | 419 |
| 0.101₂ | 1·½ + 0·¼ + 1·⅛ | 0.625 |
Converting from decimal: repeated division
- Divide the number by the target base.
- Write down the remainder — it is the next digit, from right to left.
- Repeat with the quotient until it reaches zero.
- Read the remainders from last to first.
For fractions, multiply the fractional part by the base instead: the whole-number part of each result is the next digit after the point. The tool shows both procedures.
Binary, octal and hex shortcuts
| Hex | Binary | Octal | Decimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| A | 1010 | 12 | 10 |
| B | 1011 | 13 | 11 |
| C | 1100 | 14 | 12 |
| D | 1101 | 15 | 13 |
| E | 1110 | 16 | 14 |
| F | 1111 | 17 | 15 |
Because 16 = 2⁴ and 8 = 2³, each hex digit maps to exactly four bits and each octal digit to three. To convert binary to hex, group bits in fours from the right: 1111 0101 = F5. This is why programmers use hex as a compact way to write binary.
Negative numbers: two’s complement
Computers usually store signed integers in two’s complement. To write −x in n bits, subtract x from 2ⁿ — or invert all the bits of x and add 1. In 8 bits, −1 is 1111 1111 (0xFF) and −128 is 1000 0000 (0x80). An n-bit signed value ranges from −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1, so 8 bits hold −128 to 127 and 32 bits hold −2,147,483,648 to 2,147,483,647. Choose the width in the converter to see the pattern your language or processor would store.
Worked example
Convert 255 to binary: 255 ÷ 2 = 127 r1, 127 ÷ 2 = 63 r1, and so on — eight remainders of 1, so 255 = 1111 1111₂, which groups neatly into FF in hex and 377 in octal. Now −42 in 16-bit two’s complement: 42 is 0000 0000 0010 1010; inverting gives 1111 1111 1101 0101 and adding 1 gives 1111 1111 1101 0110, or 0xFFD6. The converter shows the same.
Where you’ll meet different bases
- Binary: bits, flags, network masks and low-level hardware.
- Hexadecimal: colour codes (#FF8800), memory addresses, byte values, hashes and UUIDs.
- Octal: Unix file permissions (chmod 755).
- Base 36: compact IDs and short URLs.
- Base 60 (not in this tool): time and angles — minutes and seconds.
Common values worth knowing
| Decimal | Binary | Hex | Where you see it |
|---|---|---|---|
| 127 | 0111 1111 | 7F | Largest signed 8-bit value; ASCII range |
| 255 | 1111 1111 | FF | Largest byte; RGB colour channel maximum |
| 256 | 1 0000 0000 | 100 | Number of values in a byte |
| 1,023 | 11 1111 1111 | 3FF | 10-bit maximum |
| 65,535 | 1111 1111 1111 1111 | FFFF | Largest 16-bit unsigned value; highest port number |
| 2,147,483,647 | 0111 … 1111 (31 ones) | 7FFFFFFF | Largest signed 32-bit integer |
| 4,294,967,295 | 32 ones | FFFFFFFF | Largest unsigned 32-bit integer |
Notation in programming languages
| Base | Common prefixes | Example |
|---|---|---|
| Binary | 0b | 0b1010 |
| Octal | 0o, or a leading 0 in older C code | 0o755 |
| Hexadecimal | 0x, #, or an h suffix in assembly | 0xFF, #FF8800 |
| Decimal | none | 255 |
The converter accepts these prefixes when they match the selected base, and ignores spaces, commas and underscores used as digit separators.
Checking your answers
- Convert back the other way — you should get the original number.
- For binary, the last digit shows whether the number is odd (1) or even (0).
- A number with n binary digits lies between 2ⁿ⁻¹ and 2ⁿ − 1.
- Each hex digit is exactly four bits, so an 8-digit hex number is 32 bits.
Precision
Whole numbers are converted exactly with arbitrary-precision integers, so 200-digit numbers are fine. Fractional parts use standard floating-point arithmetic and are rounded to the number of digits you choose; many fractions repeat forever in other bases.
Privacy
All conversions run in your browser.
Frequently asked questions
How do I convert binary to decimal?
Multiply each bit by its place value (1, 2, 4, 8…) and add them up.
How do I convert decimal to hexadecimal?
Divide by 16 repeatedly and read the remainders from last to first, using A–F for 10–15.
What is 255 in binary?
1111 1111.
What is two’s complement?
The standard way to store negative integers: invert the bits of the positive number and add 1.
What is the largest base supported?
Base 36, using digits 0–9 and letters A–Z.
Can it convert fractions?
Yes, the fractional part is converted to the number of digits you choose.
Why does 0.1 look strange in binary?
0.1 has no exact binary representation — it repeats forever — which is also why computers show tiny rounding errors.
What is octal used for?
Mainly Unix file permissions, such as chmod 755.