Base Conversion Calculator
Convert numbers between different number bases including binary, octal, decimal, hexadecimal, and custom bases.
Input Number
Conversions
Binary (Base 2)
11111111
Octal (Base 8)
377
Decimal (Base 10)
255
Hexadecimal (Base 16)
FF
Base 2
11111111
How Base Conversion Works
Converting to Decimal
Example: 1010 (binary) = 1×8 + 0×4 + 1×2 + 0×1 = 10
Converting from Decimal
Example: 10 ÷ 2 = 5 R0, 5 ÷ 2 = 2 R1, 2 ÷ 2 = 1 R0, 1 ÷ 2 = 0 R1 → 1010
What Is a Base Conversion Calculator?
A base conversion calculator converts numbers from one positional numeral system to another — for example, turning the decimal number 255 into binary (11111111), octal (377), or hexadecimal (FF). Every number we write is implicitly in a base: decimal is base 10, using digits 0–9. Computers use binary (base 2), programmers use hex (base 16) for compactness, and theoretical math explores bases like ternary (base 3) or duodecimal (base 12).
This calculator converts any number from a source base (2 through 36) to its decimal equivalent using positional notation (Σ digit × base^position), then converts the decimal to the target base via repeated division — the two-step process used by parseInt() and toString() in JavaScript. It displays all five standard conversions (binary, octal, decimal, hex, and custom target base) simultaneously, so you can see a single number in every common representation at a glance.
Base Conversion Formula
Any number in base b is a sum of digits multiplied by powers of the base. To convert from decimal to base b, repeatedly divide by b and collect remainders in reverse order.
Positional Notation and Division Method
Where:
- dᵢ= The digit at position i, starting from the rightmost digit at i = 0
- b= The base — 2 for binary, 8 for octal, 10 for decimal, 16 for hex, up to 36
- N= The decimal integer value — the intermediate form used for all conversions
Understanding the Results
| Output Base | Digits Used | Example (decimal 255) |
|---|---|---|
| Binary (2) | 0, 1 | 11111111 |
| Octal (8) | 0–7 | 377 |
| Decimal (10) | 0–9 | 255 |
| Hex (16) | 0–9, A–F | FF |
| Custom (2–36) | 0–9, A–Z | Depends on target base |
The calculator uses JavaScript's parseInt(input, fromBase) and toString(toBase), which handle bases 2–36. For bases above 10, letters A–Z represent values 10–35. If the input contains invalid digits for the selected source base, an error message is displayed.
How to Use This Calculator
- Enter the number: Type the number in the input field. Use digits 0–9 for bases up to 10; for hex and higher bases, use letters A–F (or A–Z for bases up to 36). The input is automatically uppercased.
- Select source base: Choose the base that your input number is expressed in from the dropdown (binary, octal, decimal, hex, or custom).
- Select target base: Choose the base you want to convert to. All five standard conversions are always displayed, but this controls the "custom" result card.
- Read all conversions: Binary, octal, decimal, hexadecimal, and your custom target base are all shown simultaneously.
Real-World Applications
Base conversion is essential in computer science and programming. Binary is the native language of hardware; hex provides a compact, human-readable shorthand (two hex digits = one byte). Debugging memory dumps, configuring network masks, and setting file permissions all use base conversion. In digital electronics, octal was historically used for 12-bit and 36-bit computer architectures because groups of three bits map cleanly to octal digits.
Beyond computing, different bases have cultural and mathematical significance. The Babylonians used base 60 (sexagesimal), which survives in our measurement of time (60 seconds, 60 minutes) and angles (360 degrees). The Maya used base 20 (vigesimal). Understanding how positional notation works in any base deepens mathematical literacy and makes the decimal system less arbitrary.
Worked Examples
Decimal to Binary
Problem:
Convert 255 (decimal) to binary.
Solution Steps:
- 1Enter '255' as the number, set from base to 10.
- 2255 ÷ 2 = 127 R1 → 127 ÷ 2 = 63 R1 → 63 ÷ 2 = 31 R1 → 31 ÷ 2 = 15 R1 → 15 ÷ 2 = 7 R1 → 7 ÷ 2 = 3 R1 → 3 ÷ 2 = 1 R1 → 1 ÷ 2 = 0 R1.
- 3Read remainders bottom to top: 11111111.
Result:
Binary: 11111111. Octal: 377. Hex: FF.
Hex to Decimal
Problem:
What is the decimal value of hexadecimal 1A3F?
Solution Steps:
- 1Enter '1A3F', set from base to 16.
- 21 × 16³ = 1 × 4096 = 4096, A(10) × 16² = 10 × 256 = 2560, 3 × 16¹ = 3 × 16 = 48, F(15) × 16⁰ = 15.
- 3Sum: 4096 + 2560 + 48 + 15 = 6719.
Result:
Decimal: 6719. Binary: 1101000111111. Octal: 15077.
Tips & Best Practices
- ✓Uppercase letters A–Z represent values 10–35 in bases above 10 — the input is automatically uppercase for consistency.
- ✓Two hex digits always represent one byte (0–255), making hex the most compact human-readable format for binary data.
- ✓The octal representation groups binary bits in threes — each octal digit corresponds to exactly three binary bits.
- ✓To convert binary to hex manually, group binary digits in fours from the right: 1111 1111 → FF.
- ✓Use the custom base dropdown to explore unusual bases — base 36 encodes the largest numbers with the fewest characters.
- ✓The input field auto-capitalizes letters, so 'ff' and 'FF' are treated identically for hexadecimal input.
Frequently Asked Questions
Sources & References
- Positional Notation - Wikipedia (2024)
- Number Bases - Khan Academy (2024)
- Hexadecimal - Wikipedia (2024)
Last updated: 2026-06-06
Help us improve!
How would you rate the Base Conversion Calculator?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Handbook of Mathematical Functions
by Abramowitz & Stegun