Shubham Nishad

URL Shortener

Sat, Jun 24, 2017
#Django #base62


A simple and easy to use web app built using Django. Simply give the url you want reduced and get the new shortened url based on base62 encoding. Wanna try this app? Visit:

I developed this app after watching this video by Tushar Roy about tiny url. I wanted my own solution and was also interested in particle.js hence this project was born.


  • Url shortening using Base62 encoding. (a-zA-Z0-9)
  • REST API for retrieving data easily.
  • Beautiful background using particles.js
  • Fully responsive. use any device and always find the best layout.


Each url has a unique id in the database. We use this id and encode it using Base62 encoding. This encoded string is stored as the short url for the original url.

def b62_encode(number):
    base = string.digits+string.ascii_letters
    assert number >= 0, 'positive integer required'
    if number == 0:
        return '0'
    base62 = []
    while number != 0:
        number, i = divmod(number, 62)
    return ''.join(reversed(base62))

How to run the project locally

Download the zip or Clone this repository: git clone

Install the dependencies by simply executing: pip install -r requirements.txt

Run this command to start the app: python runserver

Visit on your web browser and don’t forget to give me some feedback.

How to access the api

to shorten url, send POST request to:<url to be shortened>/

to retrieve url, send GET request to: http://yourdomain/api/<shortcode>/

you can test api on:


  • making a REST api for this project.
  • suggestions are welcome

License MIT