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

SEO-Friendly URL Structure: Rules and ExamplesHow to structure URLs for SEO: slug length, hyphens vs underscores, stop words, trailing slashes, parameters and safe URL changes with redirects.Open Graph Meta TagsLearn which Open Graph and Twitter Card meta tags control link previews on Facebook, LinkedIn, WhatsApp, X, Slack, and other sharing surfaces.Meta Description Length: How Long Should It Be?Keep meta descriptions to about 150–160 characters on desktop and 120 on mobile. See pixel limits, truncation rules and a template for writing them fast.HTML Entities and EscapingLearn when to escape HTML, which characters need entities, how encoding helps prevent XSS, and when decoding HTML entities is safe.