How to use the base62 encoder decoder
- Select the Mode: encode text, decode to text, encode integer, or decode to integer.
- Paste your plain text or integer into the Input field.
- The result updates instantly as you type.
- Copy the output for use in URLs, short links, or database keys.
How Base62 encoding works
Base62 uses exactly 62 characters: digits 0-9, uppercase letters A-Z, and lowercase letters a-z. Each character represents a value from 0 to 61. When you base62 encode an integer, the tool repeatedly divides the number by 62 and maps each remainder to the corresponding character, building the string from least significant to most significant digit.
For example, to encode the integer 123456789 using the standard 0-9A-Za-z alphabet:
- 123456789 divided by 62 is 1991238 with remainder 33, which maps to
X. - 1991238 divided by 62 is 32116 with remainder 46, which maps to
k. - 32116 divided by 62 is 518 with remainder 0, which maps to
0. - 518 divided by 62 is 8 with remainder 22, which maps to
M. - 8 divided by 62 is 0 with remainder 8, which maps to
8.
Reading the remainders in reverse order gives 8M0kX. Decoding reverses this process by multiplying each character's value by increasing powers of 62 and summing the results.
Text vs integer encoding
There are two distinct ways to base62 encode data, and this tool supports both.
Integer mode treats the input as a single large number and converts it directly into base 62. This is ideal for shortening numeric IDs, generating compact tokens, or creating URL-safe identifiers from database primary keys.
Text mode first converts the string into a sequence of bytes using UTF-8, then interprets those bytes as one large big-endian integer, and finally encodes that integer in base 62. Decoding reverses the process: the base62 string becomes an integer, which is converted back to bytes, and those bytes are decoded as UTF-8 text. Because the whole input becomes one number, leading zero bytes (NUL characters) are not preserved, and this is a plain integer conversion rather than a byte-by-byte scheme like Base58. Inputs are limited to 16,000 characters. This means any Unicode character, including emoji and non-Latin scripts, can be safely encoded and decoded.
Common reference values
The table below shows how small integers map to their Base62 representations using the 0-9A-Za-z alphabet.
| Decimal | Base62 |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 10 | A |
| 35 | Z |
| 36 | a |
| 61 | z |
| 62 | 10 |
| 100 | 1c |
| 1000 | G8 |
| 1000000 | 4C92 |
Why choose Base62 over other bases
Base62 is popular because it produces strings that are safe for URLs, filenames, and HTML attributes without requiring any escaping. Unlike Base64, it avoids the +, /, and = characters that cause issues in query strings and file systems. If you need an even more restricted alphabet that removes visually ambiguous characters like 0, O, I, and l, consider Base58 encode instead. For highly compact binary-to-text encoding used in QR codes and specific protocols, Base45 encode is another option. Standard Base64 remains the best choice when you need maximum density and do not have URL-safety constraints.
Practical use cases
Developers frequently use Base62 encoding for URL shorteners. A database row with an auto-incrementing integer ID like 123456789 can be represented as a five-character string, making links much shorter while remaining reversible. It is also common in session tokens, invite codes, and public-facing identifiers where exposing a raw sequential integer might reveal business metrics or invite enumeration attacks.
Because the alphabet contains only alphanumeric characters, a base62 string never needs percent-encoding in a URL and will not break XML or JSON parsers. This makes it a reliable default for any system that passes opaque identifiers between different layers of a web application.
Worked examples
| Example | Input | Result |
|---|---|---|
| Encode "Hello" | Mode: encode-text; Input: Hello | 5TP3P3v |
| Decode "5TP3P3v" | Mode: decode-text; Input: 5TP3P3v | Hello |
| Encode integer 123456789 | Mode: encode-int; Input: 123456789 | 8M0kX |
| Decode integer "8M0kX" | Mode: decode-int; Input: 8M0kX | 123456789 |
FAQ
What characters does Base62 use?
Base62 uses the digits 0 through 9, uppercase letters A through Z, and lowercase letters a through z. That totals exactly 62 characters, all of which are URL-safe and require no escaping.
Can I base62 encode Unicode text?
Yes. The text mode converts your input to UTF-8 bytes first, then encodes those bytes as a single large integer in base 62. Decoding reverses the process, preserving all Unicode characters.
Is Base62 the same as Base64?
No. Base64 uses 64 characters including plus, slash, and equals padding, which often require URL encoding. Base62 uses only alphanumeric characters, making it inherently safe for URLs and filenames.
Does this tool upload my data?
No. All encoding and decoding happens locally in your browser. Your input is never sent to any server.
Why would I use Base62 instead of Base58?
Base62 includes all alphanumeric characters, giving slightly denser output than Base58. Base58 removes characters that look similar (like 0 and O) to prevent human transcription errors, which is useful for printed codes but unnecessary for machine-generated URLs.
Can Base62 handle very large integers?
Yes. The tool processes integers as arbitrary-precision strings, so you can encode or decode numbers far larger than standard 64-bit limits without losing accuracy.