Number Base Converter
About Number Base Converter
Enter a value, pick the base it is written in, pick the base you want. Conversion runs on BigInt, so numbers beyond 2^53 stay exact; a plain JavaScript number silently loses precision long before you would notice.
Bases 2, 8, 10, 16 and 32 are available. Input may carry prefixes (0x1F, 0b1010, 0o17), read according to the source base you picked. Negative numbers convert too.
Invalid input is rejected with a message instead of being silently truncated. Type 123 into a base-2 field and you get told which characters are illegal, not handed a wrong answer.
Which base is for what
Hex is the everyday one: colors, memory addresses, file signatures. Binary is mostly bit flags and teaching. Octal survives mainly in Linux permission bits (0755 and friends). Base 32 turns up in legacy encodings and some key formats.
Precision, in one example
2^53 is 9007199254740992. Ask a plain number to hold 9007199254740993 and it reports 9007199254740992, the last bit quietly gone. Binary and hex strings run much longer than decimal, which is why converting a long hex value to decimal is where people hit this first. BigInt has no such ceiling; the limit is your patience for copying digits.
Frequently asked questions
Why not just use parseInt?
parseInt only goes to base 36 and stops at the first invalid character, quietly. parseInt('123', 2) returns 1. This converter validates first and computes with BigInt, so nothing is truncated.
How large a number can it take?
BigInt has no practical limit; thousands of digits convert fine. The bottleneck is copying the result somewhere else.
Does it understand 0x and 0b prefixes?
Yes, when the source base matches: 0x for hex, 0b for binary, 0o for octal. Without a prefix, the selected base applies.
Can I convert negative numbers?
Yes, the minus sign carries through the conversion.