03 · UNDERSTAND THE METHOD
How the number base converter works
A positional number system uses a base to determine the value of each digit position. Decimal uses ten, binary uses two, and hexadecimal uses sixteen. This converter accepts integer digits in any selected base from two through 36 and writes the same integer in another base. It uses exact integer arithmetic rather than rounding a large value into a floating-point number. A leading minus sign preserves a negative integer’s sign.
The formula and its variables
- Integer digits
- Up to 256 digits, optionally preceded by a minus sign.
- Source base
- Integer radix from 2 through 36.
- Destination base
- Radix used to write the converted integer.
The calculation, step by step
- Enter integer digits without prefixes or separators and choose the source base. Letters A through Z represent digit values ten through 35, with either letter case accepted.
- Check that every digit is valid in the selected source base. Accumulate the magnitude using exact integer multiplication by the base and addition of each digit.
- Apply the sign and repeatedly divide by the target base to obtain its digits. Read the uppercase output as a representation of the same integer.
A worked example
Decimal 255 converts to binary 11111111 and hexadecimal FF. In hexadecimal, each F means fifteen, so FF represents 15 × 16 + 15 = 255. Decimal −255 becomes −FF in hexadecimal, preserving the sign. A digit 2 is invalid in base two and is rejected instead of being silently interpreted as a decimal value.
| Integer digits | 255 |
|---|---|
| Source base | 10 |
| Destination base | 2 |
| Converted integer | 11111111 |
How to read the result and visual
Changing a base changes written representation, not the integer’s value. Leading zero digits do not change that value. A negative output uses an ordinary minus sign; it does not describe a fixed-width computer storage pattern. Exact arithmetic makes this tool suitable for long integer conversions within the digit limit.
Assumptions, rounding, and limitations
Fractions, decimal points, radix prefixes such as 0x, grouping commas, and plus signs are not supported. The tool does not encode two’s-complement bit patterns or choose a byte width. Very long valid outputs can require horizontal reading space. Binary file contents and character encodings are different problems from converting a single integer.
Frequently asked questions
Are letters case sensitive?
No. Input letters are accepted in either case; the output uses uppercase.
Why is 0xFF rejected?
The input expects digits only. Select source base 16 and enter FF without a prefix.