Base62 Encoder / Decoder
Encode or decode Base62 strings — the alphanumeric-only alphabet behind short URL slugs and compact IDs
0-9A-Za-z — no symbols at all — which makes it safe to drop directly into a URL path segment, filename, or CLI argument without any escaping. That's why it's the usual choice behind short-link slugs (bit.ly-style) and compact database IDs, trading a slightly longer string than Base64 for zero special characters.About this tool
The ToolNinja Base62 tool encodes and decodes Base62 — an encoding scheme that uses only the 62 alphanumeric characters 0-9, A-Z, and a-z, with no symbols at all. That makes a Base62 string safe to drop directly into a URL path segment, a filename, or a CLI argument without any percent-encoding or escaping, which is why it's the usual choice behind short-link slugs and compact database IDs. Base62 trades some compactness for that safety: Base64 packs 6 bits per character (4 output characters per 3 input bytes) while Base62's non-power-of-two alphabet averages closer to 5.95 bits per character, so a Base62 string runs slightly longer than the equivalent Base64 string. In exchange, you never have to worry about +, /, or = showing up somewhere they'd break a URL or need escaping. Everything runs 100% in your browser using BigInt arithmetic — your data never leaves your machine.
When to use it
- →Generating short, URL-safe slugs for shortened links or shareable IDs
- →Encoding database auto-increment IDs into a compact, alphanumeric-only public identifier
- →Converting a hex hash or UUID into a shorter string for display or storage
- →Producing filenames or CLI arguments that never need escaping
Tips
- ◆Base62 has no padding characters (unlike Base64's =) — the decoder can tell the encoded length is valid from the string alone.
- ◆Leading zero bytes are preserved as leading '0' characters in the output, so round-tripping arbitrary binary data stays lossless.
- ◆If you need maximum compactness and don't care about URL-safety, Base64 is still shorter — Base62 exists specifically for the symbol-free guarantee.
Frequently asked questions
Is Base62 the same as Base64?
No. Base64 uses 64 symbols including + and / (or - and _ in the URL-safe variant) plus = padding. Base62 drops to exactly 62 symbols — just letters and digits — eliminating the need for any escaping or padding, at the cost of slightly longer output.
Why do URL shorteners use Base62 instead of Base64?
A Base62 string is guaranteed to contain only letters and digits, so it can be placed directly in a URL path (e.g. short.ly/aB3xQ9) with zero risk of a reserved character needing escaping. Base64's + and / are both meaningful in URLs and would need percent-encoding.
Can Base62 encode arbitrary binary data, not just text?
Yes — switch the input format to Hex and paste the hex representation of any byte sequence. The tool treats the input as raw bytes either way; the Text/Hex toggle only changes how you type the bytes in.