URL Slug Best Practices

Updated 2026-08-31 · 3 min read

What makes a good slug

A slug is the human-readable part of a URL. Good slugs are lowercase, hyphen-separated, ASCII, short enough to read in a search result, and stable once published. They should describe the page well enough that the URL alone tells you what it contains.

Before and after

Real titles turned into slugs, with the reasoning:

Rules to encode in your slugify function

A robust slugifier applies these steps in order:

Stop words, dates and IDs

Removing a, the and of shortens slugs harmlessly, but do not remove words that carry meaning — how-to and vs are often the search phrase itself. Avoid dates in slugs unless the page is genuinely time-bound news; a dated URL signals staleness the moment the year turns.

For user-generated content, append a short unique suffix (my-post-4f9c) instead of a bare counter. It guarantees uniqueness without exposing how many records you have.

Changing a slug after publishing

A published slug is an address other people link to. If you must change it, serve a 301 redirect from the old path to the new one and keep it indefinitely, update internal links to point directly at the new URL, and refresh the sitemap. Skipping the redirect drops whatever ranking and referral traffic the old URL had earned.

Slug depth and structure

Keep paths shallow: /guides/validate-json beats /blog/2026/08/dev/tools/validate-json. One meaningful directory level plus the slug is enough for most sites, and it keeps the breadcrumb, canonical URL and analytics grouping simple.

Generate a slug now

Turn any title into a clean slug with the Slug Generator, then check the wider URL pattern against the SEO-friendly URL structure guide and finish the page metadata with the Meta Tag Generator.

Try the Slug Generator →Turn any title into a clean, SEO-friendly URL slug. Choose the separator, limit words, strip accents and stop words. Free online slugify tool.

Frequently asked questions

Should slugs use hyphens or underscores?

Hyphens. Search engines treat hyphens as word separators and underscores as joiners.

How long should a slug be?

Three to five meaningful words, under about 60 characters, so it stays fully visible in search results.

Can a slug contain Arabic or accented characters?

Technically yes via percent-encoding, and it can help native-language audiences — but the encoded form is ugly when copied. ASCII slugs are the safer default.

More guides

How Many Words Is a 5-Minute Speech?A 5-minute speech is roughly 625–750 words at a normal speaking pace. See word counts for 1, 3, 5, 10 and 20-minute talks, plus how to check yours instantly.How to Validate JSON and Fix Common Syntax ErrorsLearn how to validate JSON and fix the most common errors: trailing commas, single quotes, unquoted keys, comments and unescaped characters — with examples.Base64 Is Not Encryption: What It Actually DoesBase64 is reversible encoding, not encryption. Learn what Base64 is for, when to use it, its 33% size cost, and safe alternatives for protecting data.How to Decode a JWT SafelyLearn what is inside a JSON Web Token, how to decode the header and payload, how to read exp and iat claims, and why decoding is not verification.