1001Ferramentas
πŸ”—Converters

Base62 Converter (Short URLs)

Convert decimal numbers to Base62 (0-9, A-Z, a-z) and back. This is the scheme URL shorteners use to turn IDs into short codes.

Base62

β€”

Turning sequential IDs into short codes

Your table hands out autoincrement ids and you would rather ship /3D7 than /12345. Base62 is the standard shortener trick: the same number written in a 62-symbol alphabet takes roughly half the characters. Type a decimal value into the field and the code appears immediately, so you can sanity-check a mapping without deploying anything first.

Inside it is repeated division by 62. Each remainder indexes the alphabet 0-9, then A-Z, then a-z, and digits stack up from most significant to least. So 62 becomes 10, 61 becomes z, and 12345 becomes 3D7. Watch that ordering: several popular libraries place lowercase before uppercase, and the same id then produces a code that does not match what you see here.

Three things worth checking. The field holds a floating-point number, so past 9007199254740992 (two to the 53rd) the output goes quietly wrong. Negative values are flipped to positive and decimals are truncated with no warning. And the page only goes decimal to Base62, despite the description promising a round trip. Also keep in mind that sequential codes are walkable: if the link must stay private, scramble the id before encoding it.

Frequently asked questions

Can I convert Base62 back to a number?
Not on this page. There is a single numeric field and the conversion runs one way, decimal to Base62.
Why does my library produce a different code?
Almost always the alphabet order. This tool uses 0-9, A-Z, then a-z; many implementations use 0-9, a-z, then A-Z. Both are Base62, but they are not interchangeable.
What is the largest number I can trust?
9007199254740992. Above that JavaScript loses exact integer precision and the generated code stops matching the original id.

Related Tools