Projects Personal Contact Rss
 


Arbitrary number base conversion.
This script will convert between bases 2 to 64.
Please note that all bases up to base36 are case insensitive, e.g. A=a. However, from base37-62 'numbers' are case sensitive, e.g. A!=a. A=decimal 10, a=decimal 36.
Standard base64 is handled as a special case as the character set is different (letters first then numbers and symbols).
New: The script is now able to convert real numbers (not just integers) to other bases, although we stop at 10 'decimal' places (because such fractions tend to be infinitely long). The conversion routines allow you to specify your own level of precision.

Character set used for Base 2 through Base 63 is 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_
Character set used for Base 64 is ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
Negative number input is denoted with a leading minus character
Character separated input values are supported generating same-character-separated output values.
Lists of input values are supported with a separator character (default: comma)
It also supports a special base 256 in both directions. e.g. "104 101 108 108 111" base 10 -> base 256 = "hello" (with space separator)

To enter a source number you can enter both the number and its base in the two input boxes on the left, or you can use base notation of base#number in the Input box and leave the base as blank or 0

Input: ->
      
->
Output:
Separator:
Base: Base:


The source code for the PHP base conversion functions are available at http://www.pgregg.com/projects/php/base_conversion/base_conversion.inc.phps



All content © Paul Gregg, 1994 - 2020
Page last updated: 06 April 2020 22:54:08.
This site https://pgregg.com has been online since 5th October 2000
Previous websites live at various URLs since 1994