How to Write a Good URL Slug (and Generate One in Seconds)
What a URL slug is, why hyphens beat underscores, and how to turn any title into a clean, SEO-friendly slug with a free browser tool.
The slug is the last scrap of a URL, the bit after the final slash: in belun.app/convert/url-slug-generator, the slug is url-slug-generator. It looks trivial. It isn’t. A messy slug leaks into search results, shared links, and analytics reports, and once a page is indexed you can’t fix it without breaking every link that points to it. Worth getting right the first time. The URL Slug Generator does the mechanical part; this covers the judgment part.
What a clean slug looks like
Strip a good slug down and it follows a few plain rules:
- Lowercase only.
/About-Usand/about-uscan resolve to different pages on case-sensitive servers, and that’s a headache nobody needs. - Words joined by hyphens, not spaces. A raw space becomes
%20in a URL, which is ugly in a browser bar and worse in an email. - Letters and digits, nothing else. Quotes, ampersands, and emoji get percent-encoded into noise.
- Short. Three to six words that name the page. Drop
the,a,of— they add length and nothing else.
So 10 Best Coffee Shops in São Paulo! collapses to best-coffee-shops-sao-paulo. Shorter, readable, and it survives being pasted into a chat window intact.
The hyphen-versus-underscore thing
This one has a definite answer, and it comes straight from Google. A hyphen is read as a word separator; an underscore is read as a word joiner. So blue-widget gets indexed as “blue” and “widget,” two words a searcher might type, while blue_widget is treated as the single token “blue_widget,” which nobody searches for.
Matt Cutts confirmed this on Google’s side years ago and it hasn’t changed. Use hyphens for anything the public sees. Save underscores for the places that genuinely need them — some file systems, certain database columns, code identifiers where a hyphen would be read as a minus sign.
Accents, Cyrillic, and other scripts
Here’s where a lot of hand-rolled slug code falls over. Type a title with café, piñata, or Straße and a naive script either leaves the accented character in — where it gets percent-encoded into gibberish — or drops it and mangles the word.
The generator handles this two ways. Accented Latin letters are folded to their base form, so é becomes e and ñ becomes n. Cyrillic gets transliterated to Latin, so Привет мир comes out as privet-mir rather than an unreadable %D0%9F... string. Anything with no sensible Latin equivalent is swapped for the separator and the doubles are collapsed, so you never get a slug ending in three hyphens.
Don’t rewrite slugs after publishing
One warning that’s saved me real trouble. Once a URL is live and indexed, changing the slug throws away whatever ranking it earned and 404s every existing link unless you set up a redirect. Decide on the slug before you hit publish. If you truly must change it, add a 301 redirect from the old address to the new one so search engines and bookmarks follow along.
Paste a title into the URL Slug Generator and you’ll have a clean slug before you finish reading this sentence — no signup, no upload, all in your browser.