Number Base Converter
This number base converter rewrites signed integers in binary, decimal, and hexadecimal without changing their value. It uses BigInt arithmetic to retain every digit, including integers larger than the safe whole-number range of ordinary JavaScript numbers.
By Dr. Hassan Khames EliwaLast updated
Result
- Binary
- 11111111
- Hexadecimal
- FF
How it works
Tell the converter how to read the input
A numeral only makes sense once its base is known. The text 10 means two in binary, ten in decimal, and sixteen in hexadecimal. Choose the input base before entering the digits. The converter then displays all three representations, so there is no separate output-base setting to synchronize.
Binary uses the digits zero and one, with each position representing a power of two. Decimal uses zero through nine and powers of ten. Hexadecimal uses zero through nine followed by A through F, representing values ten through fifteen, with positions weighted by powers of sixteen. Uppercase and lowercase hexadecimal letters are accepted; output uses uppercase.
Read positional value rather than the appearance of the string
In hexadecimal, FF means 15 × 16 + 15. In binary, each group of four bits corresponds to one hexadecimal digit because sixteen is two raised to the fourth power. This relationship makes hexadecimal a compact way to inspect byte values, bit masks, and identifiers without writing long binary strings.
Matching prefixes are optional: binary may begin with 0b and hexadecimal with 0x. A leading plus or minus sign comes before the prefix. A decimal field does not accept a hexadecimal prefix, and the chosen base is never guessed from a value that happens to contain only zeros and ones.
Distinguish signed notation from machine encodings
Negative results use an ordinary leading minus sign in every base. They are not two's-complement bit patterns. A two's-complement representation requires a word width, such as eight or sixteen bits, and an interpretation of the highest bit. This converter intentionally has no word-width setting and therefore does not pretend to supply that representation.
Leading zeros are removed in the output because they do not change the integer value. A negative zero is displayed as zero. If an interface requires fixed-width identifiers, add padding only after conversion and only according to that interface's documented format.
Keep exact integer boundaries explicit
The form accepts up to 1,024 input digits after any matching prefix and sign. This is an input-size limit, not a 1,024-bit limit: a 1,024-digit hexadecimal number contains many more bits than a binary number of that length. Fractions, decimal points, scientific notation, internal spaces, underscores, and commas are rejected.
No ordinary floating-point conversion occurs in the arithmetic path. That is essential when copying large database identifiers or counters: a conversion that first rounds the integer cannot recover its lost low-order digits afterward.
Worked example
Example 1: Inspecting a byte-sized maximum
A device specification lists an unsigned byte value of 255 in decimal. Select decimal and enter 255. The outputs are 255 in decimal, 11111111 in binary, and FF in hexadecimal. The eight binary ones show that every position in an eight-bit unsigned field is set. The converter itself does not impose an eight-bit width; that interpretation comes from the device specification.
Example 2: Converting a signed diagnostic offset
A diagnostic note records a negative hexadecimal offset as −0x2A. Select hexadecimal and enter -0x2A. The decimal result is -42, the binary result is -101010, and the hexadecimal result is -2A. These are signed mathematical representations of the same integer. They are not a byte encoding for negative 42, which would require choosing a width and an encoding convention.
Expert tips
Common mistakes
- Interpreting FF as a negative number assumes an unstated signed encoding. As a plain hexadecimal integer it is positive 255; signed byte interpretation is a separate operation.
- Assuming leading zeros survive conversion confuses formatting with value. A padded register display and an integer numeral can represent the same quantity while using different string lengths.
- Pasting separators from source code is not supported here. Remove spaces or underscores deliberately, after checking that they are only visual grouping marks and not part of another syntax.
Frequently asked questions
Can the converter handle values above 9,007,199,254,740,991?
Yes. BigInt preserves exact integer values beyond the ordinary safe Number boundary, subject to the stated input-length limit.
Are hexadecimal letters case-sensitive?
No. Both cases are accepted, including in a matching prefix. The hexadecimal result uses uppercase letters for a consistent display.
Can I convert fractional numbers?
No. This tool converts integers only. Fractional base conversion requires a separate treatment of fractional places and sometimes repeating expansions.
Does a minus sign mean two’s complement?
No. It means a negative mathematical integer. Two’s complement needs a fixed bit width and different formatting rules that this converter does not apply.
Why did my leading zeros disappear?
They do not affect integer value, so results are normalized without them. Apply protocol-specific padding separately when a fixed-width field requires it.
Related calculators
Related guides
MathPercentages people get wrong: change, difference and pointsThe denominator determines the answer. Learn to distinguish percentage change, symmetric difference and percentage-point movements.14 November 2026 · 7 min read
MathStandard deviation without the jargonThe average tells you the centre. Standard deviation helps describe the spread, provided you know what the data represents.14 November 2026 · 7 min readSources and standards
About the author
Dr. Hassan Khames Eliwa holds a PhD in Construction & Built Environment and has more than 20 years of international project controls experience. He is Director of Eliwa Project Controls Limited in Auckland and founder of PMMilestone.org and PMMilestone.com.
Buy me a coffee