A slug is the human-readable part of a URL that identifies a page — the url-slug-best-practices in this page's address. It is a small decision that is awkward to reverse, which is the main reason it is worth thinking about for two minutes before publishing.
Hyphens, not underscores
This is the one piece of conventional advice that is well supported. Google treats a hyphen as a word separator and an underscore as a word joiner, so word_counter is read as the single token wordcounter while word-counter is read as two words. Google's own documentation has recommended hyphens for years.
Underscores remain perfectly sensible for file names and code identifiers. In URLs they also have a cosmetic problem: an underlined link hides them completely.
Length
Shorter is better, but the reasons are practical rather than algorithmic. There is no ranking penalty at a specific character count.
- Search results truncate long URLs, so the end of a rambling slug is invisible where it matters most.
- Long URLs survive copying, pasting and messaging apps badly, picking up line breaks.
- A slug that fits in a sentence gets linked to more comfortably.
Three to six meaningful words is a good working range — roughly 40 to 60 characters. Beyond that you are usually restating the whole headline.
Stop words
Common advice says strip words like "the", "and", "for" and "a". This is worth doing only when the slug is genuinely long, and it can be taken too far. how-to-cook-rice reads properly; cook-rice is marginally shorter and slightly worse as a description. Removing stop words that carry meaning — particularly "not", "without" and "vs" — changes what the page appears to be about.
Trim them when the slug is unwieldy. Do not trim them as a reflex.
Lowercase, always
Web servers on Linux treat /About-Us and /about-us as different paths, while Windows servers do not. Mixed-case slugs therefore work fine until someone links to a different capitalisation and gets a 404, or until both versions get indexed as duplicates. Keep everything lowercase and the problem never arises.
Accents and other scripts
Accented characters need percent-encoding in a URL, so café becomes caf%C3%A9 — technically fine, ugly when shared, and a nuisance when someone types it. Stripping the accent to cafe is the pragmatic choice for Latin-script languages.
Non-Latin scripts are a different question. Cyrillic, Greek, Arabic and Chinese URLs work correctly in modern browsers and are genuinely more readable for their audiences. If your readers use that script, use it; transliteration mostly serves people who were not going to read the page anyway.
Dates and numbers
Putting a date in the slug — /2026/08/how-to-cook-rice — is standard for news and dated by design. For evergreen content it works against you: the URL visibly ages, and updating the article does not update the date in the address. Unless the publication date is part of the page's identity, leave it out.
Numbers that are part of the title, like 10-ways-to-..., are fine but lock you in. Expanding a list to twelve items means either a wrong URL or a redirect.
Changing a slug
This is the decision that actually costs money. A URL is an identity: change it and every existing link, bookmark and search result points at nothing.
If you must change one, add a 301 redirect from the old address to the new. A 301 is permanent and passes the accumulated ranking signals to the new URL; a 302 is temporary and does not. Leave the redirect in place indefinitely — old links keep arriving for years.
On a static host, that means a redirect rule in your configuration. On Netlify it is a line in a _redirects file:
/old-slug /new-slug 301
The best version of this advice is to avoid needing it: pick a slug that describes the page's enduring subject rather than its current framing.
Before publishing, ask whether the slug will still be accurate in two years. "Best headphones 2026" will not be. "Best headphones" will.
Trailing slashes
Pick one convention and apply it. /guides and /guides/ are technically different URLs, and serving identical content at both creates duplicates. Most hosts normalise this automatically; it is worth confirming yours does rather than assuming.
Does the slug affect ranking?
Only slightly, and less than most people writing about slugs imply. Google has described URL words as a very small ranking factor. The genuine benefits are indirect: a clear URL earns clicks in search results, gets shared more readily, and attracts links with useful anchor text.
Which means the honest advice is to write slugs for people. Doing that produces the keyword-appropriate version anyway, without the awkward stuffing that keyword-first thinking encourages.