Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

ShortURL

> 编程语言
Open source

Bijective conversion between natural numbers (IDs) and short strings

381 stars0 likes1 views
WebsiteGitHub

About

Bijective conversion between natural numbers (IDs) and short strings

ShortURL

Bijective conversion between natural numbers (IDs) and short strings

Useful for URL shorteners and short IDs in your permalinks

Usage

  • ShortURL.encode() takes an ID and turns it into a short string
  • ShortURL.decode() takes a short string and turns it into an ID

Features

  • very short strings (much shorter than hex)
    • uses large alphabet of 51 characters
  • URL-safe (in contrast to Base64)
    • doesn't use any characters that need to be encoded for use in URLs
  • protection against offensive words (in contrast to Base64 and hex)
    • vowels are not used
  • unambiguous (in contrast to Base64 and hex)
    • look-alike characters are not used

Example output

  • 3141592 vJST
  • 123456789 pgK8p

Number range

All numbers from 1 to 2,147,483,647 inclusively can be safely encoded and decoded again in all implementations.

Contributing

All contributions are welcome! If you wish to contribute, please create an issue first so that your feature, problem or question can be discussed.

License

This project is licensed under the terms of the MIT License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言