How to Convert a Title into a URL Slug (the Right Way)
Every time you publish a page, its title needs to become part of the URL — the readable slug like how-to-bake-bread. Doing this conversion by hand is fiddly: lowercase everything, replace spaces with hyphens, strip punctuation, handle accents. Here is how to turn any title into a clean, SEO-friendly slug the right way, in one step.
What the conversion involves
Turning a title into a slug means applying several transformations at once. Lowercase the whole thing, because clean URLs are conventionally lowercase and mixed case can cause duplicate-URL issues. Replace spaces with hyphens, the standard word separator in URLs. Remove punctuation and special characters that do not belong in a URL. Transliterate accented characters to their base letters. And often, drop small filler words to keep the slug short. Done together, these turn "How to Bake Sourdough Bread!" into how-to-bake-sourdough-bread.
Hyphens, not underscores or spaces
Use hyphens to separate words. Spaces are not allowed in clean URLs — they get percent-encoded into ugly %20 sequences — so they must be replaced. And hyphens beat underscores because search engines treat hyphens as word separators but historically treated underscores as word joiners, meaning my_page could be read as one word while my-page is correctly two. The hyphen is the SEO-recommended standard and the most readable choice.
Handling accents and special characters
Titles often contain characters that do not belong in a URL: accented letters, punctuation, symbols, emoji. Leaving accents in produces long encoded strings — café becomes caf%C3%A9 — so they should be transliterated to base letters, making café into cafe. Punctuation and symbols get stripped entirely. The result is a URL-safe slug using only lowercase letters, numbers, and hyphens, which works everywhere and survives being copied, shared, and read aloud.
Keeping slugs short
A good slug is short and focused on keywords. The auto-generated slug from a long title includes every word, which is often longer than it needs to be. Trimming filler words — the, a, of, to, and — keeps the slug tight and puts the meaningful keywords front and center. "The Complete Guide to Writing Better Meta Descriptions" can become writing-better-meta-descriptions rather than the-complete-guide-to-writing-better-meta-descriptions. Shorter is cleaner, more readable, and better for SEO.