URL Slug Best Practices: SEO-Friendly URLs in 2026
A URL slug is the human-readable, keyword-rich portion of a web address that identifies a single page — the url-slug-best-practices part of example.com/blog/url-slug-best-practices. Well-crafted slugs improve SEO rankings, boost click-through rates in search results, and make links more shareable. Poorly crafted slugs — auto-generated IDs, trailing numbers, or keyword-stuffed monstrosities — hurt all three.
This guide covers the rules every developer and content creator should follow: lowercase letters and hyphens only, 3–5 keywords, no special characters, proper handling of international text, and the slug generation algorithm you can copy into your own codebase. For a quick implementation, try our URL Slug Generator.
The Rules
1. Lowercase Only
✓ /blog/url-slug-best-practices
✗ /blog/URL-Slug-Best-Practices
✗ /blog/Url_Slug_Best_Practices
URLs are case-sensitive on most servers. Page and page are different URLs, which can cause duplicate content issues for SEO. Always use lowercase. See RFC 3986 §6.2.2.1 — the scheme and host are case-insensitive, but the path is case-sensitive.
2. Hyphens, Not Underscores
✓ /blog/url-slug-best-practices
✗ /blog/url_slug_best_practices
Google treats hyphens as word separators but underscores as word joiners. web-development is read as two words; web_development is read as one. Hyphens also look cleaner in search results.
3. No Special Characters
✓ /blog/cafe-latte-recipe
✗ /blog/café-latté-recipe
✗ /blog/what-is-c#-programming
Remove or transliterate accented characters (é → e, ñ → n, ü → u). Strip all punctuation, symbols, and non-alphanumeric characters except hyphens.
4. No Trailing or Double Hyphens
✓ /tools/json-formatter
✗ /tools/-json-formatter-
✗ /tools/json--formatter
Leading, trailing, and consecutive hyphens look unprofessional and can cause issues with some URL parsers.
Length and Keywords
Keep It Short But Descriptive
✓ /blog/url-slug-best-practices
✗ /blog/the-complete-guide-to-url-slug-best-practices-for-seo-friendly-urls-in-2026
Research suggests that URLs with 3-5 words in the slug perform best in search. Google doesn’t penalize longer URLs, but shorter ones:
- Are easier to share (messaging, social media)
- Look cleaner in search results (long slugs get truncated)
- Are more memorable
Include Your Target Keyword
✓ /blog/jwt-tokens-explained (target: "jwt tokens")
✗ /blog/article-about-tokens (too vague)
✗ /blog/post-12345 (no keywords at all)
The slug should include the primary keyword your page targets. Search engines use URL words as a ranking signal, and users are more likely to click a search result whose URL matches their query.
Remove Stop Words (Usually)
Stop words like “a,” “the,” “is,” “in,” “to,” “and” add length without SEO value:
✓ /blog/url-slug-best-practices
? /blog/what-is-url-slug (ok — "what is" matches search patterns)
✗ /blog/a-guide-to-the-best-practices-for-url-slugs
Exception: If the stop word is part of how people search (like “what is” or “how to”), keeping it can help match long-tail queries.
Slugs and International Characters
Handling non-Latin scripts (Cyrillic, CJK, Arabic, etc.) in URLs is one of the trickiest slug problems. There are two approaches:
Transliteration (recommended)
Convert non-Latin characters to their closest ASCII equivalents:
| Input | Transliterated slug |
|---|---|
| Привет мир (Russian) | privet-mir |
| Über uns (German) | uber-uns |
| 日本語テスト (Japanese) | Usually requires a manual English slug |
| Ціна товару (Ukrainian) | tsina-tovaru |
This is the safest approach because:
- Works in all browsers, tools, and APIs
- Doesn’t get percent-encoded in logs and analytics
- Readable by anyone regardless of language
Native script (use with caution)
Modern browsers display non-ASCII URLs natively: example.com/блог/привет-мир appears correctly in the address bar. But under the hood, it’s percent-encoded:
example.com/%D0%B1%D0%BB%D0%BE%D0%B3/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82-%D0%BC%D0%B8%D1%80
This makes URLs unreadable in logs, emails, and any context that doesn’t auto-decode. Use native-script URLs only if your entire audience uses that script and you’re willing to deal with encoding issues.
Punycode (for domain names only)
Punycode converts Unicode domain names to ASCII: münchen.de → xn--mnchen-3ya.de. This is handled by the browser automatically for domains via Internationalized Domain Names (IDN). Punycode does not apply to URL paths — for paths, use transliteration or percent-encoding instead.
Common Mistakes
Changing slugs after publication. Once a URL is indexed by Google, has backlinks, or has been shared, changing the slug breaks all of those references. If you must change a slug, always set up a 301 redirect from the old URL.
Using auto-generated IDs as slugs. URLs like /post/63f7a8b2c1d4e5 are meaningless to both humans and search engines. Always use descriptive slugs.
Including dates when not necessary. /blog/2026/03/12/url-slug-best-practices adds unnecessary depth. Use dates only if your content is truly time-sensitive (news articles). For evergreen content, /blog/url-slug-best-practices is better.
Translating slugs incorrectly. For multilingual sites, slugs should be transliterated or translated. /es/blog/mejores-prácticas-slug is bad (accent in URL); /es/blog/mejores-practicas-slug is correct.
Forgetting trailing slashes. Be consistent — either always use /blog/my-post/ or /blog/my-post, but not both. Configure your server to redirect one to the other. Inconsistency creates duplicate content.
Slug Generation Algorithm
A good slug generator:
- Converts to lowercase
- Transliterates non-Latin characters (Cyrillic, accented letters, etc.)
- Normalizes Unicode (NFD decomposition)
- Strips diacritical marks (accents)
- Replaces spaces and underscores with hyphens
- Removes all non-alphanumeric characters except hyphens
- Collapses consecutive hyphens into one
- Trims leading and trailing hyphens
JavaScript
function slugify(text) {
return text
.toLowerCase()
.trim()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '') // remove accents
.replace(/[^a-z0-9\s-]/g, '') // remove special chars
.replace(/[\s_]+/g, '-') // spaces/underscores to hyphens
.replace(/-+/g, '-') // collapse multiple hyphens
.replace(/^-|-$/g, ''); // trim hyphens
}
Python
import re
import unicodedata
def slugify(text):
text = unicodedata.normalize('NFD', text.lower())
text = text.encode('ascii', 'ignore').decode('ascii')
text = re.sub(r'[^a-z0-9\s-]', '', text)
text = re.sub(r'[\s_]+', '-', text)
text = re.sub(r'-+', '-', text)
return text.strip('-')
For production use, consider libraries like python-slugify (Python) or slugify (npm) that handle transliteration of Cyrillic, CJK, and other scripts out of the box.
Try It Yourself
Use our URL Slug Generator to convert any text into a clean, SEO-friendly slug instantly — with full support for Cyrillic transliteration.
For encoding special characters in URLs beyond slugs, check out the URL Encoder and URL Decoder, and read our complete guide to URL encoding.
Further Reading
- RFC 3986 — Uniform Resource Identifier (URI): Generic Syntax
- Google URL Structure Guidelines — Google’s official recommendations
- RFC 5891 — Internationalized Domain Names (IDN/Punycode)
- Google SEO Starter Guide — General SEO best practices