Number bases: converting between binary, decimal and hex
Computers count in binary, programmers debug in hexadecimal, and humans count in decimal, the same quantity wearing different masks. A base converter translates a number between any two bases from 2 to 36, showing how positional notation works: each digit is multiplied by the base raised to the power of its position.
TL;DR
- In any base, a number is a sequence of digits where each position carries a weight equal to the base raised to a power
- Formula: Value = Σ digit[i] × base^(n-1-i)
- Example 1: Binary 1010 to decimal
How it works
In any base, a number is a sequence of digits where each position carries a weight equal to the base raised to a power. Converting between bases means evaluating the source representation into its numeric value and then re-expressing that value in the target base by repeated division.
The math
To convert from a source base, multiply each digit by the source base raised to its positional power (from right to left, starting at 0) and sum the products. To convert into a target base, repeatedly divide the value by the target base, collecting the remainders from last to first as the result digits.
Each digit at position i (from the left, n digits total) is weighted by the base raised to the positional exponent, and the weighted digits are summed.
Examples
Example 1: Binary 1010 to decimal
- Digits: 1, 0, 1, 0
- Weights: 2³, 2², 2¹, 2⁰ = 8, 4, 2, 1
- Value: 1×8 + 0×4 + 1×2 + 0×1 = 10
- Result: 1010₂ = 10₁₀
Example 2: Decimal 255 to hexadecimal
- Divide 255 by 16 → 15 remainder 15
- 15 is digit F
- Result digits: F, F
- Result: 255₁₀ = FF₁₆
When to use it
✦ Programming and Debugging
Developers translate between binary, hex, and decimal for color codes, memory addresses, masks, and byte values.
✦ Computer Science Education
Students practice the mechanics of positional notation across bases to understand how computers store and represent numbers.
⚠ Common mistakes
- Using Invalid Digits: Every digit must be smaller than the source base; a digit of 2 is invalid in binary input.
- Reversing the Remainders: Remainders of the division process must be read from last to first to form the target digits.
- Confusing Base Symbols: The letters A-F represent 10-15 in hexadecimal; beyond base 36, letters are exhausted.
FAQ (6)
What is the most common base for computers?
Binary (base 2) is the native computer base, with hexadecimal (base 16) used as a compact human-readable shorthand.
Why can bases go up to 36?
Because the 10 decimal digits plus the 26 letters of the alphabet provide 36 distinct symbols for digits.
Do you save the numbers I type for area, volume or conversions?
Not at all. Every conversion — kg to lbs, area, fraction math — runs locally. No form data is posted anywhere. You can convert 1,500 kg to lbs on a shared computer and walk away knowing nothing was logged.
Will it work without internet in class?
Yes — that's why students like it. Load once on Wi-Fi, then fraction, base-converter or standard deviation work offline in class or in an exam hall without signal. It's just math in JavaScript, no server round-trip.
How accurate are the math results?
We use standard definitions (e.g. 1 kg = 2.20462 lbs, BIPM SI) and double-check edge cases via automated tests. For homework or site measurements it's more than enough, but for certified engineering or lab work, cross-check with the primary standard.
Can I share a calculation with a classmate?
Tap 'Share Link' — it puts the inputs in the URL. Your classmate opens it and sees the same 3/4 → 0.75 → 75% breakdown instantly, without retyping.