What is a URL slug and how to write good ones
Which part of the URL is the slug, why accents and special characters break things, and the rules sites that rank actually follow.
A URL slug is the last segment of a URL's path — the part that identifies one specific page within a folder or category. In docuboxer.com/blog/what-is-a-url-slug, the slug is what-is-a-url-slug. It's not the domain and it's not anything after a ? — it's the readable label that tells a visitor, and a search engine, what the page is about before they even click. You can generate a clean one in seconds with the URL slug generator, which strips accents and non-URL characters automatically.
Where the slug sits inside a URL
A full URL has several parts: protocol (https://), domain (example.com), path, and sometimes query parameters. The slug is the final piece of the path — the one that corresponds to that particular page. In https://example.com/shop/black-running-shoes?color=blue, the slug is black-running-shoes; everything after the ? is a query parameter, not part of the slug, and it usually carries little or no SEO weight on its own.
Slugifying is not the same as percent-encoding
These two operations get mixed up constantly, so it's worth being precise. Slugifying starts from a title ("Complete Guide to Router Setup") and turns it into a clean, permanent path: lowercase, words joined by hyphens — complete-guide-router-setup. Percent-encoding starts from a URL that already exists and escapes characters that are either reserved (space, &, ?, #) or outside plain ASCII, so the URL survives transport intact. Non-English text does trigger this — a café or résumé in a URL gets percent-encoded — but for most English-language sites this is a minor edge case, not the main design constraint. If what you actually need is to escape a value going into a query parameter, that's a job for the URL encoder/decoder, not a slug generator.
Hyphens, not underscores
This is the separator question people get wrong most often. Use a hyphen (-) to join words in a slug, not an underscore (_). Google explicitly reads a hyphen as a word boundary: blue-widget-sale parses as three separate terms. An underscore is read as a joining character, so blue_widget_salerisks being treated closer to one long token — which means it may not associate as cleanly with searches for "blue" or "widget" on their own. Every popular CMS defaults to hyphens for exactly this reason; don't fight the convention.
Always lowercase
A slug should be entirely lowercase, and this isn't a style preference — it's a technical one. Many servers treat URL paths as case-sensitive, so /My-Article and /my-articlecan technically serve identical content under two different addresses. That splits backlinks, social shares, and ranking signals across what search engines treat as two separate pages instead of consolidating them on one — a duplicate-content problem that's trivially avoided by writing every slug in lowercase from the start.
Length and stop words: trim, don't stuff
A useful slug is short and descriptive — three to six words is usually enough to convey the topic without an unwieldy URL. Stop words (a, the, of, to, and) can often be dropped without losing clarity: "How to Bake a Chocolate Cake at Home" becomes bake-chocolate-cake-home, not a word-for-word copy of the title. But there's a line: repeating the same keyword to game rankings (cake-cake-chocolate-cake-recipe-cake) is keyword stuffing, and it reads as spam to a visitor and to a crawler alike. Trim for clarity, not for keyword density.
On dates and numbers: if the content is evergreen — a reference guide, a how-to that won't go stale — leave the year out of the slug. Baking one in forces an awkward choice later between a URL that lies about freshness or a rename that breaks links. If the content is genuinely time-bound, like a dated announcement or a specific event, including the date is legitimate. Version or model numbers that are actually part of the name (python-3-guide) are fine too.
The expensive part: changing a slug that's already live
This is where most of the real damage happens in practice. A slug is an address, and every backlink, internal link, social share, and indexed search result depends on it staying put. Rename it and every one of those still points at a path that now 404s. If a change is genuinely necessary — fixing a typo, updating stale content that deserves a better title — don't just rename and republish: set up a permanent 301 redirect from the old URL to the new one, so both visitors and crawlers land where they should and accumulated ranking signals transfer instead of resetting to zero. Renaming a live slug without a redirect is one of the most common self-inflicted ways to lose organic traffic overnight.
Generating a clean slug
Write the title the way you would for a headline, and let the slug generator handle the mechanics: lowercase, hyphens between words, accents and stray symbols stripped out. Everything runs in your browser, with nothing uploaded — useful if the title isn't public yet. If you need case conversion for a different context, like a filename or a variable name, the case converter handles that related but distinct problem. And if the source text carries double spaces, stray line breaks, or invisible characters copied from a document, run it through the text cleaner before slugifying.
Frequently asked questions
What is a slug in a URL?
It's the final segment of the path — the part that identifies one specific page inside a folder or section. In https://example.com/blog/how-to-bake-bread, the slug is how-to-bake-bread. It doesn't include the domain, the protocol, or anything after a question mark.
Should a slug use hyphens or underscores?
Hyphens. Google treats a hyphen as a word separator and an underscore as a character that joins words together, so blue-widget is read as two terms and blue_widget risks being read as one token. Every major CMS and style guide has settled on hyphens for this reason.
Does a slug have to be lowercase?
Yes. Many servers treat paths as case-sensitive, so /My-Post and /my-post can serve the same content as two technically different URLs. That splits backlinks and ranking signals across duplicates instead of consolidating them on one canonical address.
How long should a slug be?
Short enough to stay readable, usually three to six words. Stop words (a, the, of, to) can often be dropped without losing meaning, but don't repeat the same keyword multiple times to pad it out — a stuffed slug reads as spam to both people and search engines.
Can I safely change a slug after publishing?
Only with a redirect. Every backlink, bookmark, and indexed search result still points at the old path the moment you rename it, and visitors following the old link get a 404 unless you set up a permanent 301 redirect from the old URL to the new one. Don't rename a live slug casually.
Should dates or numbers go in a slug?
Depends on the content. Evergreen guides and reference pages age badly with a year baked into the URL, so leave it out. Genuinely time-bound content — a dated event, a versioned release note — can include it, since the date is part of what the page actually is.
Generate your slug now
No accents, no special characters, no case issues. Free and 100% local.
Open slug generator →Related tools
- URL slug generator — Clean title, no accents, ready to publish.
- URL encode/decode — Percent-encoding for query parameters and reserved characters.
- Case converter — For filenames, variable names, and titles.
- Word counter — Check a title's length before turning it into a slug.
You might also like: free SEO tools you can use today.