URL Lengthener - Docs

Using the URL lengthener is super easy and free. How? Everything is encoded into the URL served. This is how you do it:

Get the script:

The script is located at /url-lengthener.js of this site, or you can use the mirror from JSDelivr, located at https://cdn.jsdelivr.net/npm/url-lengthener@latest/url-lengthener.min.js. If you would like to link it directly into your website, place either of the two lines in the <head> section of your site, with the JSDeliver file being quicker (though not by much) to fetch and the one from this site being more updated:

<script src="https://cdn.jsdelivr.net/npm/url-lengthener@latest/url-lengthener.min.js"></script>
<script src="https://aaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com/url-lengthener.min.js"></script>

If you prefer the unminified version of the code, remove the .min from whichever link you are using.

Use the script: (web)

Using the script is quite simple, as it is less than 115 lines in length. Encoding a URL takes two steps, converting from a URL to base16 and then base16 to the string of "A"s. While you could call these functions (str2hex() and hex2a() respectively), the easiest way to get a URL encoded is to use the lengthen(url) function, where url is the URL which you would like to lengthen. The function then returns a lengthened URL, which will redirect to its final destination when visited.

Use the script: (Node)

  • Install the npm package (url-lengthener)
  • Require the library:
    const urlLengthener = require("url-lengthener")
  • Use the lenghten() function to run the code:
    let lengthened_url = urlLengthener.lengthen("https://piemadd.com/");
    console.log(lengthened_url);
  • API

    Really simple, ok? You send a `GET` request here:

    https://api.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com/a?url=[YOUR_URL_HERE]

    [YOUR_URL_HERE] is where you put the URL you want to lengthen. A plaintext response with the lengthened URL is returned unless the URL is invalid, which instead INVALID_URL is returned.