Number Base Converter

Convert non-negative integers between bases 2–36 (binary, octal, decimal, hexadecimal, etc.).

CalcHub

Number Base Converter

Full page
Live

Preview

0

Add to workspace

Run up to six calculators on one board. You can try without an account—your board stays on this device until you sign in to save it.

Add to workspace

No account needed—build a local board (one workspace on this device). Sign in later to save it to your account.

Open My workspace →

A number base converter rewrites a non-negative integer in another positional numeral system without changing its underlying value. It is commonly used for binary, octal, decimal, hexadecimal, and other bases from 2 through 36. This page is designed for exact integer conversions: it validates that every character is legal in the chosen source base, then translates the same value into the target base using standard positional arithmetic.

That makes it useful for programming, electronics, data encoding, and homework checks. For example, FF in base 16 equals 255 in base 10. The tool does not interpret minus signs, fractions, prefixes like 0x, or separator characters as part of the number. If the input is valid and within the implementation’s arithmetic limits, the conversion is exact.

How This Calculator Works

The calculator first normalizes the input string and maps each symbol to its digit value. Digits are accepted only if they are valid for the selected source base. For example, 2 is not allowed in base 2, and G is not allowed in hexadecimal. If any character is invalid, the conversion is rejected instead of guessed.

Once the source string is validated, the calculator evaluates it as a positional integer. It then converts that integer into the target base by repeated division and remainder collection. The final output is the target-base digit sequence written in a consistent case, so the result can be copied into code, notes, or worksheets.

Formula

Digit value constraint: each digit must satisfy 0 ≤ di < bsource.

Positional value of the source string: N = Σi=0k-1 di × bsourcei

Target-base conversion steps: for each step j, compute rj = Nj mod btarget and update Nj+1 = floor(Nj / btarget).

Output order: the digits are written from the last remainder to the first, so output = digits(rm) digits(rm-1) ... digits(r0).

SymbolMeaning
NThe integer value represented by the source string
bsourceSource base selected by the user
btargetTarget base selected by the user
diDigit value at position i
rjRemainder produced during target-base division

Example Calculation

  1. Convert FF from hexadecimal to decimal. The source base is 16 and the target base is 10.
  2. Check the digits. In base 16, the valid digits are 0 through 9 and A through F, so F is legal and has value 15.
  3. Evaluate positionally. The rightmost F contributes 15 × 160 = 15, and the leftmost F contributes 15 × 161 = 240.
  4. Add the contributions: 240 + 15 = 255.
  5. Write the same integer in the target base. Because the target is decimal, the result is already 255.
  6. Optional reverse check: converting 255 back to hexadecimal gives FF, confirming that both notations represent the same whole number.

Where This Calculator Is Commonly Used

  • Programming: switching between binary masks, decimal counters, and hexadecimal constants in source code.
  • Computer science education: learning positional notation, place values, and base arithmetic.
  • Electronics: reading memory addresses, opcodes, register values, and bit patterns.
  • Color and data formats: working with hexadecimal encodings in protocols, palettes, and identifiers.
  • Manual verification: checking that a converted value matches the expected integer in another base.

How to Interpret the Results

The output is an equivalent integer notation, not a rounded approximation. If you convert FF from base 16 to base 10, the result 255 means both strings represent the same non-negative integer. If you convert to a larger or smaller base, the length of the notation may change significantly even though the numeric value stays the same.

When the result will be used in software, be careful about leading zeros and required widths. The calculator reports the mathematical value, but some systems expect fixed-width forms such as bytes or word-sized fields. Also remember that prefixes like 0x or 0b are usually formatting conventions, not part of the raw digit string.

If the tool rejects an input, the usual causes are an invalid digit for the chosen source base, a minus sign, a decimal point, separators, or a number that exceeds safe arithmetic limits. In those cases, confirm the intended base and remove unsupported characters before trying again.

Frequently Asked Questions

What bases does this converter support?

It supports integer conversions from base 2 through base 36. That includes common systems such as binary, octal, decimal, and hexadecimal, plus custom positional bases that use the digits 0–9 and letters A–Z. Any selected base must fall within that range for the conversion to work.

Can I enter negative numbers or decimals?

No. This calculator is designed for non-negative integers only. Minus signs, decimal points, fractions, exponents, commas, and similar notation are treated as unsupported input. If you need signed or fractional conversion, you would need a different tool or a separate method.

Why was my input rejected?

Most rejections happen because one or more symbols are not valid in the selected source base. For example, 2 is not allowed in binary, and A is not allowed in decimal. Prefixes like 0x or spaces may also cause problems if the tool expects raw digits only.

Does the calculator treat uppercase and lowercase letters the same?

Usually yes, because letter case can be normalized before conversion. a and A can represent the same digit value, depending on the implementation. The final output is typically shown in one consistent case so the result is easy to copy and compare.

Why does the output sometimes have fewer or more digits than the input?

Different bases use different place-value scales, so the same integer may take fewer digits in a larger base and more digits in a smaller one. For example, a compact hexadecimal value often expands into a longer binary string. This is normal and does not indicate a change in the underlying value.

Do leading zeros matter?

Mathematically, leading zeros do not change the value of a non-negative integer. However, they can matter in fixed-width contexts such as bytes, register values, or color codes. The calculator focuses on the numeric conversion, so you may need to restore the required width manually afterward.

How can I verify that a conversion is correct?

A simple check is to convert the result back to the original base. If the normalized source digits return unchanged, the conversion is consistent. For critical applications, it is also wise to compare the answer with another independent tool or a trusted language runtime.

FAQ

  • What bases does this converter support?

    It supports integer conversions from base 2 through base 36. That includes common systems such as binary, octal, decimal, and hexadecimal, plus custom positional bases that use the digits 0–9 and letters A–Z. Any selected base must fall within that range for the conversion to work.

  • Can I enter negative numbers or decimals?

    No. This calculator is designed for non-negative integers only. Minus signs, decimal points, fractions, exponents, commas, and similar notation are treated as unsupported input. If you need signed or fractional conversion, you would need a different tool or a separate method.

  • Why was my input rejected?

    Most rejections happen because one or more symbols are not valid in the selected source base. For example, 2 is not allowed in binary, and A is not allowed in decimal. Prefixes like 0x or spaces may also cause problems if the tool expects raw digits only.

  • Does the calculator treat uppercase and lowercase letters the same?

    Usually yes, because letter case can be normalized before conversion. a and A can represent the same digit value, depending on the implementation. The final output is typically shown in one consistent case so the result is easy to copy and compare.

  • Why does the output sometimes have fewer or more digits than the input?

    Different bases use different place-value scales, so the same integer may take fewer digits in a larger base and more digits in a smaller one. For example, a compact hexadecimal value often expands into a longer binary string. This is normal and does not indicate a change in the underlying value.

  • Do leading zeros matter?

    Mathematically, leading zeros do not change the value of a non-negative integer. However, they can matter in fixed-width contexts such as bytes, register values, or color codes. The calculator focuses on the numeric conversion, so you may need to restore the required width manually afterward.

  • How can I verify that a conversion is correct?

    A simple check is to convert the result back to the original base. If the normalized source digits return unchanged, the conversion is consistent. For critical applications, it is also wise to compare the answer with another independent tool or a trusted language runtime.