What makes a good slug
A good slug is lowercase, uses hyphens rather than underscores, contains the words someone would actually search for, and is short enough to read at a glance. It is visible in search results, in shared links and in the address bar, so it is doing real work as a preview of the page.
Hyphens over underscores is not a style preference. Search engines have historically treated hyphens as word separators and underscores as joiners, meaning my_great_post can be read as one token while my-great-post reads as three words. Underscores also disappear under the underline that links usually carry.
Accents, punctuation and other things that break
Non-ASCII characters in a URL get percent-encoded, so a French or Turkish title becomes an unreadable string of escapes when pasted into a chat client. Folding accented characters to their closest ASCII equivalent keeps the slug legible everywhere it might be copied.
Punctuation is stripped for the same reason. Apostrophes, question marks, ampersands and colons either need escaping or carry structural meaning inside a URL. Trailing hyphens from stripped punctuation should be trimmed too - nothing looks less deliberate than a URL ending in a dash.
Do not change a slug after publishing
Once a URL is live it has been linked, bookmarked and indexed. Changing the slug breaks every one of those links unless you set up a redirect, and any accumulated ranking signals go with them.
If you must change it, add a permanent redirect from the old URL to the new one and leave it there indefinitely. This is why it is worth getting the slug right before publishing rather than after.
Frequently asked questions
- Should a URL slug use hyphens or underscores?
- Hyphens. Search engines treat them as word separators while underscores can join words into a single token, and underscores are hard to see beneath a link underline.
- How long should a slug be?
- Long enough to describe the page and short enough to read - three to six meaningful words is a good target. Dropping filler words keeps it tight without losing meaning.
- How are accented characters handled?
- They are folded to their closest ASCII equivalent, so the slug stays readable instead of turning into percent-escapes when copied.
- Can I change a slug after publishing?
- You can, but every existing link breaks unless you add a permanent redirect from the old URL. Better to settle the slug before publishing.