What makes a good slug
A slug is the human-readable part of a URL that identifies a page: in example.com/blog/how-to-store-coffee-beans, the slug is how-to-store-coffee-beans. Content systems such as WordPress, Ghost, Shopify and most static site generators build it from the page title, and a good one is worth a minute of attention because it tends to stay for the life of the page.
Qualities to aim for:
- Readable. Someone seeing the link in a chat or search result should know what the page is about.
- Short. Three to six meaningful words is plenty.
how-to-store-coffee-beansworks better thanhow-to-store-your-coffee-beans-so-they-stay-fresh-for-longer-2024-guide. - Plain ASCII. Letters
a–z, digits and hyphens survive every system, email client and copy-paste without being turned into%D0%BA%D0%BE…. - Stable. Changing a slug after publishing breaks links and bookmarks unless you add a redirect, so avoid dates or numbers that will go stale, like
best-laptops-2024, unless the page really is about that year.
What the generator does to your text
The conversion runs in a fixed order, which explains every result you see:
- If Lowercase is on, the whole text is lowercased.
- Cyrillic letters are transliterated to Latin:
ж→zh,ц→ts,щ→shch,я→ya. Ukrainianє,і,їandґare included, and the soft and hard signs are dropped. - A few letters without a simple accent-free form are replaced:
ß→ss,æ→ae,œ→oe,ø→o,ł→l,đ→d,þ→th. An ampersand becomes the wordand. - Accents and other diacritics are stripped by decomposing each letter and dropping the marks, so
é→e,ñ→n,ş→sand Vietnameseệ→e. - Every run of characters that is not a letter or digit, including spaces, punctuation, quotes and emoji, collapses into a single separator.
- Separators at the start and end are trimmed.
So Crème Brûlée & Coffee: A 5-Minute Guide! becomes creme-brulee-and-coffee-a-5-minute-guide, and Харків — Львів becomes kharkiv-lviv.
Letters from scripts that are not transliterated, such as Greek, Arabic or Chinese characters, are kept as they are. They are valid in modern URLs but will appear percent-encoded in many places, so for those languages consider writing the slug by hand in Latin letters.
Choosing between hyphens and underscores
For web pages, use hyphens. Search engines read a hyphen as a word break, so coffee-beans is understood as two words. Underscores have historically been treated as joining characters, which is why coffee_beans may be read as one token. Hyphens are also easier to see in an underlined link, where an underscore disappears into the underline.
Underscores are the better choice outside the web: file names (quarterly_report_q3.pdf), database columns, environment variable names and identifiers in languages that do not allow hyphens. For converting text between naming conventions like camelCase, snake_case or CONSTANT_CASE, use the case converter.
Turn Lowercase off only when the target system is case-sensitive and you want to keep capitals, such as a wiki that uses Page_Title style links. URLs on most web servers are case-sensitive, so mixing cases invites duplicate pages and broken links.
Editing the result by hand
The generator is mechanical, and a slug usually reads better after a quick edit:
- Drop filler words. Words like
a,the,and,of,toadd length without meaning.the-ultimate-guide-to-the-best-coffeereads fine ascoffee-guide. - Watch apostrophes. An apostrophe is punctuation, so
don't panicbecomesdon-t-panic. Removing the apostrophe in the title first givesdont-panic. - Check transliteration of names. Cyrillic is transliterated with one fixed scheme. A person or brand may have an established Latin spelling, such as a passport spelling, that differs from the automatic one.
- Keep it unique. Two posts titled "Update" produce the same slug. Most CMSs append
-2automatically; if yours does not, add a distinguishing word.
Everything happens in your browser as you type. If you need the slug as part of a query parameter rather than a path, encode the full value with the URL encoder.