The slug pipeline, step by step
A slug is the readable last segment of a URL. This tool builds one with five fixed steps, applied in this order.
- Normalise (NFKD): splits accented letters into a base letter plus a combining mark, and also expands compatibility forms such as the ligature
fiand full-width digits. - Drop accents from Latin letters only: the accent pieces are deleted, leaving the plain letter. Marks that belong to other scripts (the breve on Cyrillic
й, vowel signs in Hindi) are kept, so those words are not corrupted. - Lowercase, and transliterate a few Latin letters that have no accent form:
ßbecomesss,æbecomesae,œbecomesoe,øbecomeso,đandðbecomed,þbecomesthandłbecomesl. - Remove everything except letters and digits from any script, whitespace, hyphens and underscores. Dashes such as the en and em dash count as word breaks.
- Split on every run of whitespace, hyphens and underscores, then join the pieces with one separator: a hyphen by default, or an underscore if you choose it. Nothing is left at the start or end.
Worked examples
| Input | Hyphen slug |
|---|---|
10 Best Coffee Shops in Toronto! | 10-best-coffee-shops-in-toronto |
Crème Brûlée: Café-Style Desserts | creme-brulee-cafe-style-desserts |
Tom & Jerry — snake_case | tom-jerry-snake-case |
Straße Ørsted | strasse-orsted |
- Hello - | hello |
Привет мир | привет-мир |
C++ vs C# | c-vs-c |
Punctuation other than dashes is deleted, not converted to words, so an ampersand vanishes and C++ and C# both become c. Underscores in the input become separators, which is why snake_case became snake-case. Titles in Cyrillic, Greek, Chinese, Japanese, Korean or Arabic keep their letters instead of producing an empty slug. Such slugs are valid URLs, but they are percent-encoded when copied (for example %D0%BF...), so choose an English slug if the link will often be pasted into plain text.
Why slugs matter in a URL
A slug that mirrors the page title gives visitors and crawlers a quick hint of the content, and it avoids characters that must be percent-encoded when they appear in a link. Spaces, ampersands and accented letters all turn into sequences such as %20 or %C3%A9 if left in a path, which makes shared links ugly and hard to read aloud.
Hyphen or underscore?
Google's guidance on URL structure recommends hyphens as word separators, because it reads coffee-shops as two words, while underscores can be treated as joining them. Underscores remain common in file names and some frameworks. For web pages, keep the hyphen default.
Edge cases
- Leading and trailing dashes, spaces and underscores never reach the slug:
- Hello -giveshello. A title with no letters or digits at all, such as!!!, gives an empty slug. - Two different titles can end up with the same slug, as
C++andC#show, so check uniqueness on your own site. - There is no length limit and no stop-word removal. For shorter, keyword-focused slugs, which use this same conversion after dropping stop words, use the SEO slug generator, and use the case converter for kebab-case in code identifiers, where accented letters are handled differently.