Tool for encoding / decoding with the Base62 encoding system, using all alphanumeric characters (upper and lower case) forming a base 62.
Base62 Encoding - dCode
Tag(s) : Character Encoding
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Base 62 is a positional number system using 62 distinct symbols. It allows for the representation of whole numbers using the 10 digits 0-9, the 26 uppercase letters A-Z, and the 26 lowercase letters a-z.
A commonly used alphabet is: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.
Base62 encoding involves performing a change of arithmetic base. The principle is as follows:
1 - Interpret the source data as an unsigned integer.
2 - Divide this integer successively by 62.
3 - After each division, keep the remainder (between 0 and 61) and assign it the corresponding character in the Base62 alphabet.
4 - Read the resulting characters in the reverse order of the divisions.
Example: The string dCode, encoded in ASCII as 01100100,01000011,01101111,01100100,01100101, is equivalent to the decimal number $ 430628103269_{(10)} $, which can be converted to base 62 into $ {7, 36, 3, 5, 39, 26, 53}_{(62)} $, or the characters 7a35dQr.
The correspondence between values and symbols depends on the chosen alphabet, which must be known during both encoding and decoding. Generally, the indices of the 62 symbols are:
| 0 | 0 | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 | 5 | 6 | 6 | 7 | 7 | 8 | 8 | 9 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10 | A | 11 | B | 12 | C | 13 | D | 14 | E | 15 | F | 16 | G | 17 | H | 18 | I | 19 | J |
| 20 | K | 21 | L | 22 | M | 23 | N | 24 | O | 25 | P | 26 | Q | 27 | R | 28 | S | 29 | T |
| 30 | U | 31 | V | 32 | W | 33 | X | 34 | Y | 35 | Z | 36 | a | 37 | b | 38 | c | 39 | d |
| 40 | e | 41 | f | 42 | g | 43 | h | 44 | i | 45 | j | 46 | k | 47 | l | 48 | m | 49 | n |
| 50 | o | 51 | p | 52 | q | 53 | r | 54 | s | 55 | t | 56 | u | 57 | v | 58 | w | 59 | x |
| 60 | y | 61 | z |
Decoding a Base62 string involves reconstructing the represented integer and then potentially reinterpreting it as binary data.
The method is as follows: for a Base62 string of length $ n $, denoted $ c_0 c_1 \ldots c_{n-1} $ where $ c_0 $ is the leftmost character
1 - Assign to each character its numeric value $ v(c_i) $ between 0 and 61.
2 - Calculate the decimal value using the formula $$ \sum_{i=0}^{n-1} v(c_i) \times 62^{n-1-i} $$
The resulting number can then be converted to binary and decoded into ASCII or Unicode if necessary.
Example: Decode R0Ow: R equals 27, 0 equals 0, O equals 24, and w equals 58, which is the number $ {27,0,24,58}_{(62)} $, or in decimal $ 6436402_{(10)} $, or in binary $ 11000100011011000110010_{(2)} $, or b62 in ASCII code.
A Base62 string consists exclusively of the 62 alphanumeric characters: digits 0-9, uppercase letters A-Z, and lowercase letters a-z.
Base62 is case-sensitive: A and a represent distinct values.
It is likely that the distribution of the first few digits decoded can approximately follow Benford's Law.
Fun fact: Base62 is encoded as KixpUr22 and conversely, the string Base62 is equivalent to the number 169958929504, or the binary data 00100111,10010010,01010111,01110100,01100000
Base62 maximizes the use of characters available in most text environments (letters and numbers), allowing data to be represented more compactly than number systems based on smaller bases, such as Base 10 or Basis 16.
Base 62 allows data to be compacted, it is used in URL shorteners (web page addresses), in the generation of unique identifiers in computer systems, etc.
Base 62 is sometimes used to store numbers in character strings.
dCode retains ownership of the "Base62 Encoding" source code. Any algorithm for the "Base62 Encoding" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Base62 Encoding" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Base62 Encoding" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Base62 Encoding" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Base62 Encoding on dCode.fr [online website], retrieved on 2026-03-21,