A slug is the readable part of a URL that identifies a page — the “making-good-url-slugs” at the end of this address. It is small, it is easy to ignore, and it is surprisingly consequential: a good slug is readable, stable, and describes the page, while a bad one is cryptic, brittle, and quietly harms both usability and search. Here is how to get it right, and why the details matter.
What a good slug looks like
A good slug reads like a short answer to “what is this page?” It is lowercase, uses hyphens between words, contains no spaces or punctuation beyond those hyphens, and is short enough to take in at a glance. Compare the two below and the difference is obvious even before you consider search engines.
- Good: /blog/reduce-cloud-costs
- Bad: /blog/Post_ID_48213?ref=home
- Good: /guides/clean-pasted-text
- Bad: /guides/How-To-Clean-Your-Pasted-Text-Right-Now
The formatting rules
Most of a slug’s quality comes from mechanical rules that are easy to apply consistently. Lowercase everything, because some servers treat URLs as case-sensitive and a mix of cases invites duplicate-URL confusion. Use hyphens rather than underscores to separate words — search engines have long treated hyphens as word boundaries and underscores as joiners, so “clean-text” reads as two words while “clean_text” can read as one.
- Separate words with single hyphens, never spaces or underscores.
- Strip punctuation entirely: apostrophes, commas, exclamation marks, and slashes all go.
- Fold accented characters to their plain ASCII form, so “café” becomes “cafe”.
- Remove emoji and any character that would need percent-encoding in a URL.
- Collapse repeated hyphens and trim any hyphen from the start or end.
That last point matters because encoded characters make a URL ugly and hard to share. A space becomes a percent code, an accented letter becomes a string of them, and the result is unreadable and awkward to paste into a message. Fold and strip before publishing, not after.
Slug GeneratorType a title to see it fold accents, strip punctuation, and join words into a clean slug as you go.Length and stop words
Shorter slugs are easier to read, easier to share, and less likely to be truncated in a search result. Three to five meaningful words is a good target. You rarely need the whole title: a post called “The 10 Best Ways to Reduce Your Cloud Computing Costs in 2026” works better as reduce-cloud-costs than as the full mouthful.
Part of trimming is dropping stop words — “the”, “a”, “and”, “of”, “to” — which add length without adding meaning to a URL. Removing them keeps the slug focused on the words that describe the page. Keep them only when dropping one changes the sense or makes the slug read strangely.
Case, before you slugify
If you are working from a title in an unusual case — a heading in all capitals, or a string in camelCase or snake_case pulled from a spreadsheet or a file name — normalise it first. Converting to a consistent case before generating the slug avoids odd word boundaries, especially when a compound word has been jammed together without spaces.
Case ConverterNormalise an all-caps or camelCase title to sentence case first, so word boundaries are clean before you slugify.The rule that matters most: don’t change published slugs
Once a URL is live, treat it as permanent. Every link to it, every bookmark, every share, and every bit of search ranking is attached to that exact address. Change the slug and all of those break — visitors hit a 404, and the page starts again from nothing in search results. If you must change one, set up a redirect from the old slug to the new one so the links keep working.
The practical takeaway: spend the thirty seconds to get the slug right before you publish, because that is the cheap moment. Afterwards it is expensive. Generating and tidying the slug happens in your browser, so a title for an unannounced post is not sent anywhere before you are ready to publish it.