Text & writing

What Is a URL Slug, and How Do You Create a Good One?

A URL slug is the readable, keyword-carrying tail of a web address, like how-to-brew-coffee. Learn what a slug is, what makes a good one, how a title becomes a clean slug, why hyphens beat underscores, and whether you should ever change a slug after publishing.

5 min readUpdated Jul 25, 2026

Every web address has a part a human can actually read - the tail end that names the page. In example.com/blog/how-to-brew-coffee, that final how-to-brew-coffee is the slug. Get it right and the URL is short, memorable, easy to share and gives search engines a clear hint about the page. Get it wrong and you end up with something like /?p=482 or /Blog/My%20First%20Post!!, which is ugly to share and tells nobody anything. This guide explains what a slug is, what makes a good one, and how the Slug Generator turns any title into a clean, URL-safe version in one step - all in your browser, with nothing uploaded.

What exactly is a slug?

A slug is the human-readable part of a URL that identifies a specific page, usually derived from the page's title. Break a typical address into its parts and it is easy to spot: in https://example.com/blog/best-pizza-recipe, https is the protocol, example.com is the domain, /blog is the path, and best-pizza-recipe is the slug. The word comes from newspaper publishing, where a "slug" was the short nickname editors gave a story while it moved through production - the same idea survives in the content management systems that power most websites today, which build a slug from each post's headline. A slug uses only a limited set of characters: lowercase letters, digits and a single separator. It deliberately leaves out spaces, capital letters, accents and punctuation, because those are either disallowed in a clean URL or have to be percent-encoded into unreadable escape codes.

Why slugs matter

A good slug does three jobs. It is readable: a person glancing at how-to-brew-coffee knows what the page is about before they click, which lifts trust and click-through from search results and shared links. It is a ranking signal: search engines read the words in a URL, and a slug that contains the page's main keywords reinforces what the page is about - not a huge factor on its own, but a free one. And it is shareable and stable: a short, word-based slug survives being pasted into a chat message or read aloud, where a string like /product?id=48721&ref=hp would not. Because the slug shows up in the browser tab, in search snippets and in the link preview on social media, it is one of the most visible pieces of text you never think to design.

What makes a good slug

  • Keep it lowercase. The path of a URL is case-sensitive, so /My-Post and /my-post can point to two different pages; sticking to lowercase avoids duplicate-content confusion.
  • Use hyphens between words - not underscores or spaces (more on this below).
  • Include the main keywords and drop the filler. best-pizza-recipe is stronger than the-best-pizza-recipe-you-will-ever-make; short words like "the", "a" and "of" add length without meaning.
  • Keep it short - a handful of words is plenty. Long slugs get truncated in search results and are awkward to share.
  • Stick to plain ASCII. Strip accents and non-Latin characters to their closest equivalents so the link works everywhere and never turns into percent-encoded gibberish.
  • Make it stable. Choose a slug you will not need to change, because changing it later breaks every existing link (see the last section).

How a title becomes a slug

Turning a headline into a slug is a fixed sequence of transformations, and the Slug Generator applies them the moment you type. First it normalises accented and composed characters and removes the accent marks, so "e" with an acute accent becomes plain "e" and "n" with a tilde becomes "n". Then, if you leave the lowercase option on, it lower-cases everything. Next it replaces every run of characters that is not a letter or digit - spaces, punctuation, symbols, emoji - with a single separator, collapsing "Hello World!!!" down to one hyphen between the two words rather than several. Finally it trims any separator left dangling at the start or end. The result is guaranteed to contain only letters, digits and your chosen separator.

Take the messy title Cafe Rene: A Beginner's Guide (2024 Edition), typed with the proper accents on Cafe and Rene. Run it through with a hyphen separator and lowercasing on, and you get cafe-rene-a-beginners-guide-2024-edition. Notice what happened: the accents were stripped to plain letters, the colon, apostrophe and parentheses were removed, every gap between words became a single hyphen, and the closing bracket did not leave a stray hyphen dangling on the end. That string is now safe to drop straight into any URL.

Hyphens or underscores?

This is the one choice the tool leaves to you, and for web addresses the answer is almost always hyphens. Google has said for years that it treats a hyphen as a word separator but an underscore as a word joiner - so best-pizza-recipe is read as three separate words while best_pizza_recipe is read as the single token "bestpizzarecipe". For a URL you want the words seen individually, so use hyphens. The underscore option exists because the same clean-up is useful outside the web: file names, database columns and code identifiers often use snake_case, where underscores are the convention. Pick the separator to match the destination - hyphens for links, underscores for the odd file or variable name. For code naming specifically, the Case Converter also offers camelCase and snake_case output.

Should you change a slug after publishing?

Avoid it if you can. A page's slug is part of its permanent address, so once a link has been published, shared or indexed by search engines, changing the slug breaks every one of those links - visitors hit a 404, and any search ranking the old URL had earned is lost. If you genuinely must change it, because the title changed substantially or the original slug was bad, set up a 301 redirect from the old slug to the new one so existing links and search equity carry over. The practical lesson is to get the slug right before you publish: decide on a short, keyword-led, lowercase, hyphenated version up front, which is exactly what generating it from your final title produces.

A slug is a small piece of a URL that does a surprising amount of work - for readers, for sharing and for search. The rules are simple enough to apply by hand, but doing it consistently across every page is exactly the kind of fiddly job worth automating. Paste your title into the Slug Generator, choose hyphens for a web address, and copy a clean slug that is ready to use.

Frequently asked questions

Are hyphens or underscores better in a URL slug?
Hyphens, for anything that goes in a web address. Search engines treat a hyphen as a space between words, so best-pizza-recipe is understood as three words, while an underscore joins them into the single token bestpizzarecipe. Underscores still have their place in file names, database columns and code identifiers written in snake_case, which is why the tool offers both - but for the slug in a URL, choose the hyphen.
Can a slug contain capital letters, spaces or accents?
Technically a URL can carry them, but you should not. The path of a URL is case-sensitive, so /My-Post and /my-post can be treated as two different pages; spaces must be percent-encoded as %20, which is ugly and error-prone; and accented or non-Latin characters get encoded into long escape sequences that no longer read as words. A good slug sidesteps all of this by using only lowercase letters, digits and hyphens - which is what the generator produces by lowercasing, stripping accents to plain letters, and replacing every space and symbol with a separator.
How long should a URL slug be?
Short - typically three to five words is plenty. A slug only needs to carry the page's main keywords, so drop filler words like the, a, of and and unless they change the meaning. Long slugs get truncated in search results, are harder to read and share, and dilute the keywords that matter. Generate the slug from your title, then trim it back to the few words that actually describe the page.