Overview
Introduction
This tool converts a single integer written in one number base into its equivalent representation in a different base, supporting any base from 2 through 36.
It generalizes the more specific binary/octal/hex converters in this category into one flexible tool for any radix pairing.
What Is Integer Base Changer?
A converter that takes one integer string, a "from" base, and a "to" base, and outputs the same value re-rendered in the target base.
Digits above 9 use lowercase letters a through z, following the standard convention for bases beyond 10 (like hexadecimal's a-f).
How Integer Base Changer Works
The input string is stripped of an optional leading "-" sign, and each remaining character is checked against the from-base's valid digit set.
Those digits are accumulated into a BigInt value by repeatedly multiplying by the from-base and adding each digit's value.
That BigInt magnitude is then repeatedly divided by the to-base, collecting remainders as digits (using letters for values above 9) until it reaches zero, with the sign reapplied at the end.
When To Use Integer Base Changer
Use it whenever you need to convert between two specific, possibly unusual bases, like base 7 to base 20, rather than one of the common binary/octal/hex pairs.
It's also useful for teaching positional number systems in bases other than the common ones.
Often used alongside Integer to Binary Converter, Integer to Octal Converter and Integer to Hex Converter.
Features
Advantages
- Supports any base from 2 to 36 in either direction, not just the common binary/octal/hex/decimal set.
- Uses BigInt internally so very large numbers convert without losing precision.
Limitations
- Only supports a single integer value per conversion, not a list.
- Limited to bases 2 through 36, the range representable with digits 0-9 and letters a-z.
Examples
Best Practices & Notes
Best Practices
- Double-check which value is the "from" base and which is the "to" base before converting, since swapping them gives a completely different (and likely invalid) result.
Developer Notes
Uses `BigInt` throughout the accumulation and re-expansion steps (rather than plain `Number`) specifically so large values in unusual bases don't silently lose precision the way floating-point arithmetic would.
Integer Base Changer Use Cases
- Converting between two uncommon bases directly, without an intermediate decimal step
- Teaching or exploring positional number systems beyond binary/octal/hex/decimal
- Checking manual base-conversion homework or puzzles
Common Mistakes
- Entering a digit that's invalid for the chosen from-base, such as "g" with a from-base of 16.
- Mixing up the from-base and to-base fields.
Tips
- For the common bases (2, 8, 16), the dedicated Integer to Binary/Octal/Hex Converters may be more convenient since they work on a full list at once.