Base36 is a
binary-to-text encoding
A binary-to-text encoding is encoding of data in plain text. More precisely, it is an encoding of binary data in a sequence of printable characters. These encodings are necessary for transmission of data when the channel does not allow binary dat ...
scheme that represents
binary data
Binary data is data whose unit can take on only two possible states. These are often labelled as 0 and 1 in accordance with the binary numeral system and Boolean algebra.
Binary data occurs in many different technical and scientific fields, wher ...
in an
ASCII
ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
string format by translating it into a
radix-36 representation. The choice of 36 is convenient in that the digits can be represented using the
Arabic numerals
Arabic numerals are the ten numerical digits: , , , , , , , , and . They are the most commonly used symbols to write decimal numbers. They are also used for writing numbers in other systems such as octal, and for writing identifiers such as ...
0–9 and the
Latin letters
The Latin script, also known as Roman script, is an alphabetic writing system based on the letters of the classical Latin alphabet, derived from a form of the Greek alphabet which was in use in the ancient Greek city of Cumae, in southern Italy ...
A–Z
(the
ISO basic Latin alphabet
The ISO basic Latin alphabet is an international standard (beginning with ISO/IEC 646) for a Latin-script alphabet that consists of two sets (uppercase and lowercase) of 26 letters, codified in various national and international standards and ...
).
Each base36 digit needs less than 6 bits of information to be represented.
Conversion
Signed
32- and
64-
bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented a ...
integers
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
will only hold at most 6 or 13 base-36 digits, respectively (that many base-36 digits can overflow the 32- and 64-bit integers). For example, the 64-bit signed integer maximum value of "
9223372036854775807" is "" in base-36.
Similarly, the 32-bit signed integer maximum value of "
2147483647" is "" in base-36.
Standard implementations
In the
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fr ...
standard (ANSI INCITS 226-1994), functions like
parse-integer
support a radix of 2 to 36.
Java SE
Java Platform, Standard Edition (Java SE) is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).
The platform uses J ...
supports conversion from/to String to different bases from 2 up to 36. For example
an
Just like
Java (programming language), Java,
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
also supports conversion from/to String to different bases from 2 up to 36
PHP
PHP is a General-purpose programming language, general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementati ...
, like Java, supports conversion from/to String to different bases from 2 up to 36. Use th
base_convertfunction, available since PHP 4.
Go supports conversion to string to different bases from 2 up to 36 using the built-in
strconv.FormatInt()
, and
strconv.FormatUint()
functions, and conversions from string encoded in different bases from 2 up to 36 using the built-in
strconv.ParseInt()
, and
strconv.ParseUint()
functions.
Python allows conversions of strings from base 2 to base 36.
See also
*
*
Uuencoding uuencoding is a form of binary-to-text encoding that originated in the Unix programs uuencode and uudecode written by Mary Ann Horton at UC Berkeley in 1980, for encoding binary data for transmission in email systems.
The name "uuencoding" is deriv ...
References
External links
A discussion about the proper name for base 36at the Wordwizard Clubhouse
a list of words that are
prime number
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only way ...
s in base 36
A Binary-Octal-Decimal-Hexadecimal-Base36 converterwritten in
PHP
PHP is a General-purpose programming language, general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementati ...
A C# base 36 encoder and decoderCode sample in C# that demonstrates the HexaTriDecimal Numbering System including string parsing, as well as increment/decrement operations
Binary-to-text encoding formats
Computer arithmetic
Data serialization formats
{{Data Exchange