View on GitHub

Algorithmic Twitter URL shortener is an algorithmic URL shortener for Twitter URLs.

Given a full URL to a tweet such as, this can be shortened to When the short URL is requested, it is algorithmically expanded to a URL. Since the shortening is done algorithmically, no database is needed, and the requirements for running this code are very small.

Try it Now!

Tweet URL:


The base 10 tweet ID is converted to a NewBase60 number to compress it. The ID is appended to forming the shortened URL for the tweet.


To un-shorten a link, the NewBase60 number is converted back to its base 10 equivalent. The base 10 ID is appended to This takes advantage of a feature of where they will redirect a tweet URL to the correct username.


Q: Why do I need this?

A: You probably don't

Q: Where is this used?

A: You can see an example of where this is useful on the IRC logs for the #indiewebcamp IRC channel.