What is a URL slug?
The readable part of a web address that identifies the page. What belongs in one, what does not, and why changing it later is more expensive than it looks.
A slug is the readable part at the end of a web address that identifies a specific page.
In example.com/what-is-a-url-slug, the slug is what-is-a-url-slug.
The name comes from newspaper production, where a slug was the short label a story travelled under before it had a headline. The job is the same: a short, stable identifier that a human can read.
What makes a good one
Readable without decoding. Someone should be able to look at the URL and know what the
page is. /what-is-a-url-slug does that; /p?id=4471 does not.
Hyphens, not underscores. Search engines have historically treated hyphens as word
separators and underscores as word joiners, so url_slug risks being read as one token.
Hyphens are also the overwhelming convention, which matters on its own.
Lowercase. URL paths are case-sensitive on most servers, which means /About and
/about can be two different pages. Sticking to lowercase removes an entire category of
duplicate-content problem.
Short, but not cryptic. Trim filler words — the, a, and — where doing so keeps
the meaning. Do not trim so far that the slug stops being readable.
No dates unless the date is the point. /2024-guide-to-x needs rewriting every January
or it looks stale forever.
Where slug generators usually fail
Transliteration. A generator that strips characters it does not recognise turns
Södermalm into sdermalm and Straße into strae. Both are unreadable, and neither
matches what anyone would search for.
The correct behaviour is to map each character to its closest ASCII equivalent before
removing anything — and to know that ß, ø and æ are letters in their own right
rather than accented versions of something else, so Unicode decomposition alone will not
handle them.
There is also a genuine per-language decision: German convention renders ü as ue,
Swedish convention renders it as u. A tool that picks one silently will be wrong half the
time. The slug generator here asks.
Changing a slug later
Every existing link to the old URL breaks, including links from other sites, which are the ones you cannot fix. Search rankings reset while the new URL is discovered and re-evaluated.
If you must change one, redirect the old URL permanently to the new one. That preserves most of the accumulated value and keeps existing links working — but it is a repair, not a substitute for choosing well the first time.