Definition
What it is
A slug is the part of a URL that names the resource in plain words. In https://example.com/blog/how-to-write-a-slug/, the slug is how-to-write-a-slug. It is lowercase, hyphen-separated, ASCII-only and free of spaces, accents and punctuation. It is not an ID (IDs are opaque, slugs are readable) and it is not the title (titles keep spaces and accents; slugs do not).
In content management systems, the slug is often generated automatically from the title by a slugifier — a function that lowercases, strips diacritics, replaces whitespace and punctuation with hyphens, and truncates to a safe length. WordPress calls it sanitize_title; Django calls it slugify; Rails calls it parameterize.
Why it matters
The slug is the only part of the URL a human reads. It appears in browser bars, in link previews, in search results and in chat previews. A URL like /p/8472/ tells nothing; a URL like /blog/cache-invalidation-strategy/ tells the reader what to expect before opening it. Google has confirmed that URL words carry a small ranking signal; the bigger benefit is the click-through rate, not the algorithm.
Anatomy of a slug
graph LR A["¿Cómo crear un jardín?"] -->|lowercase| B["¿cómo crear un jardín?"] B -->|strip diacritics| C["¿como crear un jardin?"] C -->|fold punctuation to hyphen| D["como-crear-un-jardin"] D -->|truncate| E["como-crear-un-jardin"] style A fill:#FFF3E0 style E fill:#E8F5E9
Slug vs title vs id
Aspect | Title | Slug | ID |
|---|---|---|---|
Audience | Human readers | URLs, search engines | Databases |
Accents allowed | Yes | No | N/A |
Spaces allowed | Yes | No | N/A |
Readable | Yes | Yes, if well done | No |
Stable | No, can change | Yes, ideally immutable | Yes |
Primary use | Display | URL path | Foreign keys |
How to design a good slug
Designing a slug that ages well
Lowercase, always
URLs are case-sensitive on most servers.
Cacheandcacheare two different pages.Hyphens, not underscores
Google recommends hyphens. Underscores are invisible in underlined links.
Drop stop words when the meaning survives
how-to-write-a-slugreads better thanhow-to-write-a-slug-for-a-blog-in-2026.Under 60 characters
Longer slugs get truncated in search results and link previews.
Immutable unless you redirect
Changing a slug without a 301 breaks backlinks and search ranking.
Common failures
Origin
In newspaper printing, a slug was a short line of type set above an article, identifying it for the editor and the typesetter. It was not the headline (which was the display copy) and not the story (which was the body); it was the internal label that let everyone in the newsroom refer to the story by one short name. From the print newsroom the word moved to editorial software, where it named the short identifier used in file names and internal references. From editorial software it moved to blogs and CMSs, where it named the short identifier used in URLs.
The slug is the URL-friendly version of the post title. It is usually all lowercase and contains only letters, numbers, and hyphens.
— WordPress Support, *Posts → Slugs*, 2024
Evidence
FAQ
- How long should a slug be?
Under 60 characters. Longer slugs get truncated in previews and search results.
- Can a slug contain numbers?
Yes.
2026-cache-trendsis a valid slug.- How do I change a slug without losing SEO?
Add a 301 redirect from the old URL to the new one. Google transfers ranking through 301s over time.
- Is a slug the same as an ID?
No. An ID is opaque and machine-generated; a slug is readable and human-generated. Both can identify the same resource.
Connections
WordPress Support (2024). Page/post settings screen — Slugs. https://wordpress.org/documentation/article/page-post-settings-screen/
Google Search Central (2023). SEO starter guide — URL structure. https://developers.google.com/search/docs/crawling-indexing/url-structure
Wikipedia (2024). Slug (web publishing). https://en.wikipedia.org/wiki/Clean_URL#Slug
Etymology
Origin: metaphor
slug(noun): originally a short line of type in newspaper printing, identifying a story
Semantic network
● broader ● narrower ● related
Used in the garden
- Changelog (1×)
- Graph tokens: entities, child-nodes, author-schema (1×)
- On-Page SEO and Content Optimization: The Complete Guide (1×)
- Content SEO: How to Structure Articles That Rank (1×)
Sources
WordPress Support (2024). Page/post settings screen — Slugs. https://wordpress.org/documentation/article/page-post-settings-screen/
Google Search Central (2023). SEO starter guide — URL structure. https://developers.google.com/search/docs/crawling-indexing/url-structure
Wikipedia (2024). Slug (web publishing). https://en.wikipedia.org/wiki/Clean_URL#Slug