Tool for coding with Base45 encoding, using 45 ASCII characters, which has become known since its use in the European green pass/certificate.
Base45 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!
The Base45 encoding consists in writing the data in base 45 and using the following list of symbols 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./: Which corresponds to the 45 characters that can be used in a QR-code in alphanumeric mode so the correspondance table
Encoding begins by cutting the data to be encoded from left to right in groups of 2 bytes. If the data has an odd number of bytes, the last group is 1 byte in size.
Example: Encode the 3 characters B45, of ASCII code [66,52,53], which are then split [66,52],
Each pair of 2 bytes $ [a, b] $ is interpreted as a number in base $ 256 $ such that $ n = (a \times 256) + b $ (in base 10) which can then be converted into base 45 via a triple $ [c,d,e] $ such that $ n = c + (d \times 45) + (e \times 45^2) $. The characters in the correspondence table for the values '[c, d, e]' are noted (in that order) as encoded text.
Any last single byte $ a $ at the end of the data is also interpreted as a number in base 256 and converted to a pair $ [b,c] $ such that $ a = b + (45 \times c) $. The characters in the correspondence table for the values [b,c] are noted (in that order) as encoded text.
Example: The couple [66,52] corresponds to the number 66 * 256 + 52 = 16948 and 16948 = 28 + 16 * 45 + 8 * 45 ^ 2, so the triplet [28,16,8] that is equivalent to the characters S,G,8 in base45
The remaining byte  is written in base 45 as follows: 53 = 1 * 45 + 8, either the pair [1,8] or the characters 1,8 in base45. The full encoding of B45 in base45 is SG881
For any string written in Base45, start by converting the characters into numeric values (according to the correspondence table).
Example: Decode SG881, or the values [28,16,8,8,1]
Divide the values into groups of 3, from left to right. If the last group of 3 is not complete, add zeros 0 at the end.
Example: [28,16,8,8,1] splits as [28,16,8],[8,1,0]
Interpret each group [c,d,e] as a number in base 45 as follows: $ n = c + (d \times 45) + (e \times 45^2) $ and note the values $ n $ obtained
Example: [28,16,8],[8,1,0] is converted to ,
Convert each number to base 256 (so in bytes)
Example: 16948 = 66 * 256 + 52 or [66,52] and 53 remains  in base 256
Example: [66,52,53] for the 3 ASCII characters B,4,5 (plaintext)
Base-45 uses the 36 uppercase alphanumeric characters 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ completed with the characters (space)', $ (dollar), % (percent), * (asterisk), + (plus), - (minus/dash), . (period), / (slash) and : (colon).
Base-45 is optimized to transmit data with the alphanumeric mode of QR-codes.
It has been used in COVID-19 vaccines certificates and European Union green passes.
Reminder : dCode is free to use.
The copy-paste of the page "Base45 Encoding" or any of its results, is allowed as long as you cite dCode!
Cite as source (bibliography):
Base45 Encoding on dCode.fr [online website], retrieved on 2023-02-08,