URL slug best practices for SEO
How to write short, readable slugs that help rankings and users: length, keywords, hyphens over underscores, and the mistakes to avoid.
Keep slugs short and descriptive
A slug is the human-readable tail of a URL, and the best ones describe the page in a handful of words. Aim to convey the topic without repeating the whole headline, since long slugs get truncated in search results and are awkward to share. Dropping filler words like a, the and of usually keeps the meaning while trimming length. A slug such as url-slug-best-practices tells a reader and a crawler what to expect before the page even loads.
Hyphens, lowercase and ASCII
Three conventions make a slug robust across the web. Use hyphens between words because search engines read them as spaces, keep everything lowercase so the same address is never duplicated by casing, and fold accents to plain ASCII so the link survives copy and paste, email clients and older systems. Underscores and encoded characters both work technically, but they read less cleanly and can confuse tools that expect the hyphenated lowercase style.
Include keywords, but naturally
A slug is a modest ranking signal and, more importantly, a preview shown in search snippets, so a relevant keyword near the front helps. The trick is restraint: repeating a term or stuffing several keywords looks spammy and reads badly. Write the slug as you would a very short, honest label for the page. If the title already contains the target phrase, slugifying it and then trimming the extras usually lands in the right place.
Changing a slug after publishing
Once a page is live its slug is part of a real address that people may have linked or bookmarked, so change it sparingly. If you must, set up a permanent redirect from the old slug to the new one to preserve traffic and any accumulated ranking. Settle on a clear slug before you publish to avoid the churn. When you do generate one, capping the length to a whole word keeps it neat without ever splitting a term.