What is a URL Slug?
What slugs are, how to write good ones, SEO best practices, and how to generate them from any title or phrase.
What is a slug?
A URL slug is the human-readable part of a URL that identifies a specific page. It's the portion after the last forward slash — lowercase, with words separated by hyphens, and no special characters.
https://example.com/blog/how-to-make-pizza
──────────────────
this is the slugThe term "slug" comes from the publishing industry, where it referred to a short name given to an article during production.
How slugs are generated
Converting a title to a slug involves a few consistent steps:
Input: "What is a URL Slug? (A Complete Guide!)" 1. Lowercase: "what is a url slug? (a complete guide!)" 2. Remove special: "what is a url slug a complete guide" 3. Replace spaces: "what-is-a-url-slug-a-complete-guide" 4. Trim hyphens: "what-is-a-url-slug-a-complete-guide" Output: "what-is-a-url-slug-a-complete-guide"
Slug best practices for SEO
Use hyphens to separate words
Google treats hyphens as word separators. Underscores are treated as joiners — "word_count" reads as "wordcount".
Include your target keyword
The slug is one of the lightest-weight ranking signals. Match it to the primary keyword of the page.
Keep it short
Shorter slugs are easier to read, share, and remember. Aim for 3–5 words. Drop articles (a, an, the) and filler words.
Include dates unless necessary
Date-based slugs (/2024/06/post-title) date your content and make it harder to update URLs later without breaking links.
Use underscores
Use hyphens instead. Google officially recommends hyphens over underscores for word separation.
Use uppercase letters
URL slugs should be lowercase. Some servers treat uppercase and lowercase URLs as different pages, causing duplicate content issues.
Good vs. bad slug examples
| Bad slug | Better slug |
|---|---|
| /blog/post-123 | /blog/how-to-make-pizza |
| /2024/06/01/my-new-article | /articles/compound-interest-explained |
| /What_Is_A_Mortgage | /what-is-a-mortgage |
| /the-complete-and-definitive-guide-to-making-sourdough-bread-at-home | /sourdough-bread-guide |
| /tools/json%20formatter | /tools/json-formatter |
Frequently asked questions
- Should I change a slug after publishing?
- Avoid it if possible. Changing a slug breaks any existing inbound links and causes Google to treat the new URL as a fresh page, losing any ranking equity the old URL had built up. If you must change it, set up a 301 redirect from the old URL to the new one immediately — this passes most of the ranking value to the new URL.
- How do I handle non-English characters in slugs?
- The safest approach is to transliterate to ASCII equivalents: ü → u, é → e, ñ → n. For CJK characters (Chinese, Japanese, Korean), use a meaningful English translation rather than the romanized pronunciation. Percent-encoded non-ASCII slugs work technically but are hard to read when shared.
- Does slug length affect SEO?
- Google truncates URLs in search results display at around 60–70 characters. Longer slugs aren't penalized, but they're harder to read and share. More importantly, every extra word in the slug dilutes the keyword signal. A slug of /how-to-calculate-mortgage-payments sends a clearer signal than /a-complete-guide-to-understanding-how-to-calculate-your-monthly-mortgage-payment.