Base Converter

Convert a number from one base to another

Enter Info


About this Base Converter

Base-2 to base-62 are accepted. "A" stands for 10, "Z" for 35, "a" (lower-case) for 36 and "z" (lower-case) for 61. Decimals are supported. This is a custom implementation as PHP only goes up to base-36 natively and lacks support for decimals (and has precision issues).

Tip: add ending 0's to numbers with decimals for better precision, such as 0.5000 instead of simply 0.5.

If you know of any standard for displaying numbers higher than base-36 or you know of some interesting uses of high mathematical bases (not base64-encoding, though), please let me know.

Fun game: Enter your name and supply base-36 (or higher) as the starting base and see what number you get in another base. For instance, my first name in base-38 returns EPKCO in base-42.

What's this about?

A base is the system with which numbers are displayed. If we talk about base-n, the system has n characters (including 0) available to display a number. Numbers are represented with digits which are smaller than n. Therefore, 3 in base-3 is 10: because that system doesn't have a "3", it starts over (1, 2, 10, 11, 12, 20, 21, 22, 100, etc.).

The base we usually use is base-10, because we have 10 (when including 0) digits until we start over again (8,9,10). In base-2 (binary), we only have 2 characters, i.e. 0 and 1, until we start over again. Following this example, the binary number 10 is 2 in our (base-10) system.

Does it make sense that a finite fraction ("decimal") is infinite in another base?

It totally does. If you want to convert 421 from base-7 to base-10, you do 4*72 + 2*71 + 1*80 = 211. After the comma you keep on decrementing the exponent, meaning that if you have 421.35 in base-7 you get to its base-10 equivalent by doing 4*72 + 2*71 + 1*70 + 3*7-1 + 5*7-2. However, note that 7-1 (= 1/7) is 0.142857... in base-10, while the same value is simply displayed as 0.1 in base-7.


Online base converter, convert number to another base, change base of number, base converter with support for decimals, fractions in base, bin2hex