CALCULATOR WORKSPACE
CONVERTERS / CALCULATOR

Number Base Converter

Convert whole integers among binary, octal, decimal and hexadecimal.

YOUR INPUTS

Calculate Number Base Converter

01 / 02
No 0x/0b prefix, spaces, commas or decimal point; a leading minus is allowed.
YOUR ANSWER

Results

02 / 02
=

Your result will appear here

Enter values above, then select Calculate result. Your inputs stay in this browser.

THE BASICS

How one integer is rewritten across bases 2, 8, 10 and 16

The digits of an integer represent different place values in different bases. Rather than reinterpreting '101101' as decimal, this converter expands each source digit at its power of the chosen base and rewrites the exact integer in the destination notation.

A string of digits has meaning only with its base. The binary string 101101 means 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰, or 45 in decimal. Hexadecimal uses A through F for digit values 10 through 15; those characters are invalid in smaller bases. This page validates before conversion instead of guessing which notation you intended.

Digit place tiles show how the exact integer is assembled before re-encoding. Invalid source digits and unsupported machine-bit interpretations are rejected instead of guessed.

YOUR INPUTS

How the digits, source base and destination base are interpreted

The same characters can stand for very different integers, so the source base matters as much as the digits. The input rules are strict to avoid guessing.

Whole-number digits
Up to 64 characters of digits with an optional leading + or hyphen-minus, and nothing else: no 0x or 0b prefix, spaces, commas or decimal point. Lowercase hex is accepted, so ff becomes 255, and leading zeros count toward the 64 characters. A typographic minus sign pasted from a document is rejected, so retype it as a hyphen.
Source base
This states how the digits are already written, and it changes their value: 777 is 511 if octal but seven hundred seventy-seven if decimal. A digit equal to or above the base is refused with that digit named, so 102 in binary fails on the 2. Set this field before reading anything in the result.
Destination base
Only the notation of the output changes, and the facts list the same integer in all four bases, so octal 777 also reads 1FF in hex and 111111111 in binary. Hex output is always uppercase. Choosing the same base twice simply normalizes the digits, removing leading zeros and turning −0 into 0.
Size limit
The magnitude may not exceed 2⁶⁴ − 1, which is 18446744073709551615 in decimal, FFFFFFFFFFFFFFFF in hex and sixty-four 1s in binary. One more, hex 10000000000000000, is rejected even though it is only 17 characters long. Decimal input therefore tops out at twenty significant digits.

Steps

  1. Enter an integer's digits without a 0x or 0b prefix; A–F are valid only for hexadecimal.
  2. Choose the base the entered digits already use, then the base you want to read.
  3. Inspect each place contribution, the decimal value and the rewritten integer; negatives retain a leading sign.

Reading tip: Read the place-value tiles from left to right. Each tile shows one normalized source digit and its exponent; the contribution values sum to the decimal magnitude shown in the facts.

PRACTICAL USES

Programming and study tasks that need a base conversion

01

Read a binary value

Expand bits by positional powers of two and display the matching decimal integer.

02

Check a hex identifier

Convert hexadecimal A–F digits to the same unsigned magnitude in other bases.

03

Validate an input

Catch digits that cannot exist in the selected base before using a converted answer.

04

Inspect place value

See how shifting one digit left multiplies its contribution by the source base.

THE METHOD

How the calculation works

FormulaAt a glance
Positional source value=N = Σ(digitᵢ × source baseⁱ) → destination digits
Where:
dᵢ
Numeric value of a source digit; A to F represent 10 to 15 in hexadecimal.
b / i
Selected source base / exponent of a digit counted from zero at the rightmost place.
t / remainder
Chosen destination base / next least-significant output digit from repeated division.
sign
Optional mathematical minus on the magnitude, not a fixed-width two's-complement encoding.
COMPLETE FORMULA & VARIATIONS
N = Σᵢ₌₀ᵏ dᵢ × bⁱ, where 0 ≤ dᵢ < b
For target base t, divide N by t repeatedly; each remainder is a digit
Write remainders in reverse order and keep a leading minus on nonzero negative inputs

Only whole signed-magnitude integers with absolute value at most 2⁶⁴−1 are supported; no prefixes or fractional parts.

What every part means

dᵢ
Numeric value of a source digit; A to F represent 10 to 15 in hexadecimal.
b / i
Selected source base / exponent of a digit counted from zero at the rightmost place.
t / remainder
Chosen destination base / next least-significant output digit from repeated division.
sign
Optional mathematical minus on the magnitude, not a fixed-width two's-complement encoding.

Calculate it step by step

1. Interpret source
Magnitude N = Σ(dᵢ × bⁱ), with 0 ≤ dᵢ < b

The rightmost digit has exponent zero; b is the selected source base.

2. Re-encode
N = q×target base + remainder; repeat with q until q = 0

Read remainders from last to first to form the destination digits.

3. Preserve sign
Output = optional leading − + destination magnitude

A minus sign stays mathematical and is never treated as two's-complement bits.

The parser processes digits with BigInt, so the 64-bit magnitude limit is checked without losing integer precision. Source spelling is normalized by removing leading zeros; a negative zero becomes zero.

WORKED EXAMPLE

See it in practice

01 Sample inputs
Whole-number digits
101101
Digits are in
Binary (base 2)
Convert to
Decimal (base 10)
02 Put values into the formula

Binary 101101 = 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 32+8+4+1 = 45 decimal. Dividing 45 by 10 yields decimal digits 45.

03 Verified result45Integer in base 10
  • Decimal value45
  • Binary101101
GOOD TO KNOW

Interpretation & limitations

How to read your result

Binary, octal, decimal and hexadecimal in the result facts all denote the same integer. Changing a digit or its position changes the magnitude; changing only the output base changes notation.

Where this estimate stops

Fractions, prefixes such as 0x, separators, Unicode digits and fixed-width signed machine formats are outside scope. An absolute magnitude greater than 2⁶⁴−1 is rejected to keep the visual and input manageable.

COMMON QUESTIONS

Frequently asked questions

01Why is 101101 binary equal to 45 decimal?

Its one bits occupy positions worth 32, 8, 4 and 1. Their sum is 45.

02Does a negative result use two's complement?

No. A leading minus is a mathematical sign here. Fixed-width signed binary requires a bit width and a representation convention, which are not selected.

03Why does F work in hexadecimal but not decimal?

F is the digit value 15, which fits a base with digits 0 through 15. Decimal permits only values 0 through 9.

04What happens to leading zeros?

They do not change the integer. The result uses normalized digits, so extra leading zeros are removed.

05Can I type 0xFF?

No. Select hexadecimal in the source list and enter FF without the 0x prefix.

06Can this show a negative number's memory bits?

No. That needs a chosen bit width and signed representation. Here a leading minus simply prefixes the converted positive magnitude.

FURTHER READING

Sources & references

KEEP EXPLORING

Related calculators