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

Each digit d at position i: d × base^i

Example: 1010 (binary) = 1×8 + 0×4 + 1×2 + 0×1 = 10

Converting from Decimal

Divide by base, remainder is digit

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

To decimal: Σ dᵢ × bⁱ (i from 0 at rightmost digit) From decimal: repeat N ÷ b, collect remainders in reverse

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 BaseDigits UsedExample (decimal 255)
Binary (2)0, 111111111
Octal (8)0–7377
Decimal (10)0–9255
Hex (16)0–9, A–FFF
Custom (2–36)0–9, A–ZDepends 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

  1. 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.
  2. Select source base: Choose the base that your input number is expressed in from the dropdown (binary, octal, decimal, hex, or custom).
  3. 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.
  4. 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:

  1. 1Enter '255' as the number, set from base to 10.
  2. 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.
  3. 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:

  1. 1Enter '1A3F', set from base to 16.
  2. 21 × 16³ = 1 × 4096 = 4096, A(10) × 16² = 10 × 256 = 2560, 3 × 16¹ = 3 × 16 = 48, F(15) × 16⁰ = 15.
  3. 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

The calculator supports bases 2 through 36 using the standard 0–9, A–Z digit set. Common bases include binary (2), octal (8), decimal (10), and hexadecimal (16). Less common bases like ternary (3), quaternary (4), quinary (5), and duodecimal (12) are also available in the dropdown.
The calculator first converts your input to a decimal integer using parseInt(input, fromBase), which multiplies each digit by the appropriate power of the source base and sums them. It then converts the decimal to the target base using toString(toBase), which repeatedly divides by the target base and collects remainders.
Base 36 is the practical limit because we run out of alphanumeric characters — 0–9 (10 digits) plus A–Z (26 letters) = 36 possible digit symbols. Beyond base 36, you'd need to invent new symbols, which isn't standardized. This matches JavaScript's built-in parseInt/toString limit.
If you enter '123' with source base 2 (binary), the input is invalid because binary only allows digits 0 and 1. The calculator will display 'Invalid number for the selected base' and won't produce conversions. The same applies to letters outside the valid range for any base.

Sources & References

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.

Source

Formula Source: Handbook of Mathematical Functions

by Abramowitz & Stegun

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.