Dev tools

Number base converter

Convert an arbitrarily large integer between any base 2-36, using exact bigint arithmetic (no float precision loss). Runs on your device.

Runs on your device. The file is never uploaded.

Number base converter rewrites a whole number from one base into another, both between 2 and 36, using digits 0 to 9 then a to z. Every step uses BigInt, so a 200-digit value survives with no rounding anywhere. The digit set holds no dot, so a fraction like 3.75 is refused rather than truncated.

Options

Questions

Which bases can it convert between?

Any base from 2 to 36, in either direction. Digits run 0 through 9 and then a through z, so base 16 uses 0-f and base 36 uses 0-z. Input is lowercased before parsing, so FF and ff both work. The defaults are 255, from base 10 to base 16. A base outside the range is refused with "from must be a whole number 2-36" or "to must be a whole number 2-36".

Will a large number lose precision?

No. The parsing, the arithmetic and the formatting all use BigInt, so a 200-digit number converts exactly. There is no floating-point step for digits to drift in, and no upper limit other than your own memory. That is the difference between this and a converter built on parseInt, which starts rounding once a value passes 2^53.

Can I convert a decimal fraction like 3.75?

No, whole numbers only. A dot is not in the digit set, so 3.75 stops with the message that "." is not a valid digit in base 10. Convert the integer part on its own, or work the fractional digits out by hand. Negative whole numbers are fine: a leading minus is taken off, the digits are read, and the sign is put back on the result.

Why does it say a character is not a valid digit?

Because that character is not legal in the base you chose. The check runs per character against the digit set for that base, so a 9 in base 8 gives the message that "9" is not a valid digit in base 8. Spaces, commas and thousands separators inside the number fail the same way. Strip the grouping and try again; an empty value gives "empty number".

What does the output look like?

One line naming both bases, for example 255 (base 10) = ff (base 16). Letters in the result are lowercase. Your input is echoed back exactly as typed, so the whole line can be pasted into a comment or a commit message and still read correctly months later.

Is anything sent to a server?

No. The conversion is a few lines of arithmetic running in a Web Worker in this tab. There is no request, no logging and no account, and the page keeps working with your network switched off after the first visit.

Related Dev tools