Base36 is a
binary-to-text encoding
A binary-to-text encoding is code, encoding of data (computing), data in plain text. More precisely, it is an encoding of binary data in a sequence of character (computing), printable characters. These encodings are necessary for transmission of ...
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, wh ...
in an
ASCII
ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
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
The ten Arabic numerals (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) are the most commonly used symbols for writing numbers. The term often also implies a positional notation number with a decimal base, in particular when contrasted with Roman numera ...
0–9 and the
Latin letters a-z (the lowercase
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 u ...
).
Each base36 digit needs less than 6 bits of information to be represented.
Conversion
Signed
32- and
64-
bit integers
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
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
The C standard library since C89 supports base36 numbers via the strtol and strtoul functions
In the
Common Lisp standard (ANSI INCITS 226-1994), functions like
parse-integer
support a radix of 2 to 36.
Java SE supports conversion from/to String to different bases from 2 up to 36. For example
an
Just like
Java (programming language), Java,
JavaScript also supports conversion from/to String to different bases from 2 up to 36
PHP, like Java, supports conversion from/to String to different bases from 2 up to 36 using 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.
Raku supports base2 to base36 for all its real numeric types with its builtins:
base
and
parse-base
.
See also
*
*
Uuencoding
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 (mathematics), 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 ...
s in base 36
A Binary-Octal-Decimal-Hexadecimal-Base36 converterwritten in
PHP
A C# base 36 encoder and decodersample 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