DevKitHub

Programming

URL Slug Generator

Paste a title to get a URL slug. Accents are removed from letters rather than removing the letters, and characters that are not accented ASCII are transliterated rather than dropped.

Slug

Slug
creme-brulee-the-definitive-guide
Length
33 characters

This tool runs entirely in your browser. Your input is never uploaded, stored or logged.

How it works

The naive slug is lowercase text with every non-alphanumeric run replaced by a hyphen, and it quietly destroys words. "Crème Brûlée" becomes "crme-brle", because stripping non-ASCII removes the letter along with its accent. Normalising to Unicode NFD first splits an accented letter into a base letter plus a combining mark, so removing the marks leaves the letter behind and the result is "creme-brulee".

NFD does not cover everything, and that is the second half of the problem. Letters like ß, æ, ø, ł, đ and þ are not decorated ASCII — they are distinct letters — so they decompose to nothing and vanish entirely, turning "Straße" into "strae". Those are transliterated from an explicit table instead. The table is deliberately limited to the Latin script: one that claimed to transliterate Greek, Cyrillic or CJK would be wrong in languages its author does not read, so Unicode mode keeps those characters instead, which is legal in a URL and has been since RFC 3987.

Ampersands and at signs are spelled out rather than dropped, because "Rock & Roll" reducing to "rock-roll" loses a word. Separators are collapsed and trimmed, truncation prefers a word boundary unless that would leave almost nothing, and optional stop-word removal never returns an empty slug — a title made entirely of stop words is still a title.

Common problems

Every example below is run against this tool in our test suite, so what it says here is what the tool actually does.

Nothing is left after transliteration.

日本語
Why:
ASCII mode can only keep characters that transliterate to ASCII, and a title written entirely in a non-Latin script has none. Returning an empty slug would produce a URL that collides with every other one like it.
Fix:
Turn on Unicode mode to keep the original characters. Non-ASCII slugs are legal in URLs and are percent-encoded automatically.

There is nothing to make a slug from.

!!! ???
Why:
The input contains no letters or digits at all, only punctuation, so every character is separator material and the result would be an empty string.
Fix:
Include at least one letter or digit in the title.

The slug is only digits.

Why:
A title like "2026" produces the slug "2026", and many routers match a purely numeric path segment as an id parameter before they try the slug route.
Fix:
Prefix it with a word — "2026-in-review" — so the route is unambiguous.

Frequently asked questions

Why not just strip everything that is not a-z?
Because it deletes letters. "Crème" becomes "crme" — the accent takes the letter with it. Normalising to NFD first separates the accent from the letter so only the accent is removed.
Are non-ASCII slugs safe to use?
Yes. RFC 3987 allows them and browsers percent-encode them automatically. They display correctly in the address bar. The reason to prefer ASCII is tooling that has not caught up, not correctness.
Should I remove stop words?
Usually not. It shortens the slug but can change what a title means, and the ranking benefit is negligible. It is off by default for that reason.

Last updated