Base62 Encoder/Decoder

URL-safe alphanumeric encoding — 0-9, A-Z, a-z only

Ad placeholder (leaderboard)

Base62 encodes data using the 62 characters 0-9, A-Z, and a-z — every alphanumeric character and nothing else. With no symbols to escape, the output drops cleanly into URLs, filenames, and HTML attributes, which is why it is a favourite for short link slugs and compact IDs. This tool encodes integers or UTF-8 bytes to Base62 and decodes them back, all in your browser.

How it works

Base62 is positional base conversion against the alphabet 0-9A-Za-z:

  1. In integer mode the input number is divided by 62 repeatedly; each remainder picks one character, read most-significant first. JavaScript BigInt is used so arbitrarily large IDs encode exactly.
  2. In bytes mode the input bytes are treated as one big-endian integer and converted the same way, with each leading zero byte emitted as a leading 0 so the value round-trips.
  3. Decoding accumulates each character’s value back into the integer, then either prints the number (integer mode) or rebuilds the bytes (bytes mode).

Edge cases are handled explicitly: the number 0 encodes to a single 0, empty input yields empty output, and any character outside the alphabet is rejected by name.

Tips and example

The integer 1000000 encodes to 4C92 in Base62 — four characters instead of seven digits, which is the whole point when building short URLs. Decoding 4C92 in integer mode returns 1000000. If you need a checksum or a human-transcription-proof alphabet, prefer Base58 instead; Base62 optimises for the shortest possible URL-safe string rather than for resisting typos.

Ad placeholder (rectangle)