Host your own URL shortener (and pastebin) for $0 in ~5 minutes with Cloudflare Workers

Most URL shorteners force a trade-off: hosted services like Bitly nickel-and-dime you for custom domains, while self-hosted options (YOURLS, Shlink, Kutt) need a VPS and a database.

Url-Shorten-Worker is the entire application in a single index.js on Cloudflare Workers + KV. No server, no database, no Docker, no build step - fits the Workers free tier (100k requests/day).

What you get

  • Short links on your own domain, optional custom paths
  • REST API for programmatic link creation
  • New: Pastebin mode - share text/code up to 10 MiB, ?raw=1 plaintext output
  • New: CAPTCHA protection via CAP Worker (fails open)
  • Optional Google Safe Browsing checks
  • English + Chinese docs

Deploy in ~5 minutes

  1. Create a KV namespace (Workers & Pages KV Create).
  2. Create a Worker, bind KV as LINKS.
  3. Paste index.js, deploy.
  4. Optionally bind your own domain.

Demo: https://lnks.eu.org (demo links expire in 24h - self-host for keeps)

Repo: https://github.com/xyTom/Url-Shorten-Worker?utm_source=rentry - MIT, ~1.8k stars.

Honest limits

One KV-backed single-file app - great for personal/team use, not a multi-tenant SaaS. Need dashboards and accounts? Look at Kutt or Dub.

<a href="https://fazier.com" target="_blank"><img src="https://fazier.com/api/v1//public/badges/launch_badges.svg?badge_type=launched&theme=light" width=120 alt="Fazier badge" /></a>

Edit

Pub: 23 Nov 2026 06:57 UTC

Edit: 23 Nov 2026 10:19 UTC

Views: 5