What a slug is, in plain words
A slug is the human readable bit at the end of a URL. In aldeacode.com/blog/seo-slugs-that-last, the slug is seo-slugs-that-last.
The job of a slug is to tell people (and search engines) what the page is about, in a way that survives years of edits. The post title might change, the layout might be redesigned, the CMS might be migrated, but the URL ideally never moves. Every time you change the URL of a page that has incoming links, you bleed a bit of the SEO equity those links carried.
A good slug is a small thing you can get right once and forget about. A bad slug is a decision you regret every time you have to redirect old URLs.
Strip accents, even if your language has them
If you write in Spanish, French, German or Portuguese, your titles have accented letters. Your slug should not.
/es/blog/jamón-ibérico-de-bellota looks fine in your CMS. Then it travels through email, SMS, a stranger’s WhatsApp message that strips accents, an old browser that double encodes, an analytics tool that lower-cases inconsistently. By the time the URL has been pasted back and forth six times, the accents have been mangled in ways you do not control.
The fix is to strip accents from the slug while keeping them in the title. Jamón ibérico de bellota (the title) becomes jamon-iberico-de-bellota (the slug). The page reads correctly, the URL travels safely, and the canonical tag tells search engines what the real page is.
The slug generator on AldeaCode does the strip plus normalise plus lowercase routine in one click, in your browser.
Use hyphens, not underscores
Google has stated multiple times that hyphens separate words in URLs and underscores do not. seo-slugs-that-last is read as four words. seo_slugs_that_last is read as one. Hyphens win.
Spaces never belong in a URL. Either you encode them as %20 and the URL looks ugly, or your tool encodes them as + and you hit the plus space ambiguity from the URL encoding rules. Hyphens are the only safe and readable choice.
If your CMS defaults to underscores, change it now. Migrations are painful, but starting wrong and migrating later is more painful than starting right. The WordPress slug generator and the Shopify slug generator both default to hyphens and replicate each platform’s normalisation rules in your browser.
Keep slugs short, but not cryptic
Three to six words is the sweet spot for most posts. A slug like how-to-debug-jwt-in-30-seconds is descriptive and readable. A slug like the-comprehensive-guide-to-jwt-debugging-with-modern-javascript-techniques-and-best-practices is comically long and gets truncated in every social share preview, every email link, every search result.
Short slugs also age better. A short slug stays relevant if the post evolves. A long slug full of specifics (debug-jwt-with-jwt-io-fast-2024) becomes outdated the moment the year changes or the recommended tool moves on.
The pragmatic rule: aim for slugs that fit in 60 characters total, including the leading path. Anything longer reads as spammy and gets truncated by display engines.
Decide your Unicode policy upfront
If you target an English speaking audience, your slugs are pure ASCII (a-z 0-9 -). If you target Japanese, Chinese, Russian or any non Latin script, the choice gets harder.
Modern browsers handle Unicode URLs (called IDN, Internationalised Domain Names, when in the domain part). Search engines index them correctly. The catch is that they get encoded as percent escaped UTF-8 in the address bar, so a Japanese slug becomes a long string of %XX%XX%XX... when copied. Beautiful in the browser, ugly in a chat message.
The two reasonable policies are:
- Romanise everything:
tokio-vs-osakainstead of the Japanese characters. Works for any audience, looks the same in any chat client. - Use the native script: full Unicode slugs. Better for users typing the URL or seeing it in their language, harder to share across platforms.
Pick one and stick to it. Mixing both creates inconsistent URLs across the same site, and search engines treat them as different paths.
Avoid the migrations that bleed link equity
Every time you change a URL, the previous URL becomes a 404 unless you set up a redirect. A redirect preserves most of the SEO value but loses about 5 to 10 percent each time. Migrate twice in a year and you have lost a quarter of your link equity for that page.
The fixes are not exotic:
- Decide your slug rules at launch, not after 100 posts.
- Never put the year, the day, or any time-bounded fact in the slug.
- Never put your company name in the slug, the domain already does that.
- Never tie the slug to internal IDs that might change in a CMS migration.
When you do have to migrate, set up a 301 redirect from old to new for every changed URL. The slug generator on AldeaCode is useful when you need to bulk regenerate slugs in a consistent format. The find and replace tool is useful for batch editing the redirect map.
A practical 30 second checklist
Before you publish a post:
- Slug is lowercase, no accents, no special characters.
- Slug uses hyphens, not underscores or spaces.
- Slug is between three and six words.
- Slug describes the page, not the date or the author.
- Slug fits in 60 characters total with the leading path.
The slug generator, the remove accents tool when you have a long block of text to flatten, and the URL cleaner when you want to strip tracking parameters from a final URL all run in your browser. Slugs are one of those tiny details that a good editor sets up once and never has to think about again. Spend 30 seconds, save five years of regret.