What Is a URL Slug?

🔍 4K searches/mo💡 5 min read

A slug is the part of a web address a human actually reads. It's small, it's easy to overlook, and it shows up in search results, shared links, emails, and browser history — which means it quietly works for or against every page you publish. Here's what a slug is, what a good one looks like, and how the tools you already use build them.

Advertisement

What is a URL slug, exactly?

Break a URL into its parts — the full anatomy is worth a look in our URL anatomy guide — and the slug is the final segment: the readable name of the page itself.

https://example.com/blog/10-tips-for-better-photos/

The slug is 10-tips-for-better-photos. Everything before it is protocol, domain, and folder structure; the slug is the part that names the page. A slug can be anything the server can route — a number, a hash, a random string — but the useful kind is descriptive: lowercase words separated by hyphens.

The word comes from the newspaper era, where a "slug" was the short working title editors gave a story as it moved through the newsroom. The web kept the name and the job.

What makes a good slug?

Four habits cover almost every situation:

So a title like 10 Tips for a Better Café Résumé in 2026! becomes 10-tips-for-a-better-cafe-resume-in-2026 — 40 characters, fully readable, and identical in every browser and email client. The slug generator does this conversion live as you type.

How long should a URL slug be?

Under about 60 characters is the practical ceiling, and shorter is usually better. Search results truncate long URLs, chat apps and QR codes mangle them, and a long slug almost always means a long headline got pasted in whole. Compare:

SlugCharactersVerdict
best-coffee-grinders19Tight and descriptive
10-tips-for-a-better-cafe-resume-in-202640Fine for an article
the-ultimate-guide-to-finding-the-best-coffee-grinders-for-your-home-in-202676Bloated — trim to best-home-coffee-grinders

Note the fix for the last row: drop stopwords (the, to, for, your), keep the two or three words people actually search, and the slug carries more meaning in less than half the space.

Hyphens or underscores?

Hyphens, for public URLs. Every major web framework agrees — WordPress's sanitize_title, Django's slugify, Laravel's Str::slug, and Rails's parameterize all produce hyphenated slugs by default — and Google has said for years that it treats hyphens as word separators. Underscores still have honest work in file names and internal wiki pages, where they sort and read well. But when a URL is meant to be seen, hyphenate it.

How does each system build slugs?

The rules differ just enough to matter when you're moving between tools:

SystemDefault behaviorLength limit
WordPressLowercase, hyphens, most punctuation strippedpost_name column: 200 chars
DjangoLowercase, hyphens, non-ASCII droppedSlugField: 50 chars by default
LaravelLowercase, accents transliterated, hyphensWhatever your validation allows
RailsLowercase, hyphens via parameterizeWhatever your model allows
GitHubRepo names keep case; letters, digits, . _ - allowed100 chars

The near-universal pattern is lowercase-and-hyphenate. GitHub is the deliberate exception — repository names read as brand names, not page addresses, so casing survives.

Do slugs affect SEO?

Modestly, and mostly through relevance and click-through. A slug that matches the search phrase confirms, to the human scanning results, that the page is what they asked for. A URL stuffed with stopwords or, worse, a meaningless ID does the opposite. It's one of the few ranking-adjacent elements you fully control at publish time, which is why it's worth ten seconds — spin up the slug generator, pick the two or three words that matter, publish.

What slugs don't do is rescue content. The words in the slug echo the words on the page; they don't replace them. And once a page earns links, its slug becomes infrastructure: changing it requires a 301 redirect or every inbound link breaks.

What should never go in a slug?

Short list, no exceptions: spaces (become %20), accented characters (é becomes %C3%A9), apostrophes, ampersands, emoji, and dates in evergreen content. The date habit is sneaky — best-phone-2024 looks outdated the day a newer model ships, while best-phone keeps earning. Use dates only when the content is genuinely pinned to a moment, like a conference recap.

The bottom line

A slug is the name your page wears everywhere it travels. Keep it lowercase, hyphenated, three to five words, under 60 characters, and free of anything that percent-encodes. Generate it before you publish with the slug generator, pair it with clean meta tags, and check how it'll read in search with the SERP optimizer. The whole discipline takes less time than typing the title twice.

Turn any title into a clean URL slug

Accents stripped, symbols dropped, hyphenated — live as you type.

Slug Generator →
Advertisement

Frequently Asked Questions

What is a URL slug?

The slug is the last, human-readable segment of a URL. In example.com/10-tips-for-better-photos, the slug is 10-tips-for-better-photos. It names the page in a way people and search engines can read, unlike an ID or a query string.

Should a URL slug use hyphens or underscores?

Hyphens. WordPress, Django, Laravel, and Rails all generate hyphenated slugs by default, and Google has long treated the hyphen as its preferred word separator in URLs. Underscores are best left to file names and wiki-internal pages.

How long should a slug be?

Three to five words and roughly 60 characters or fewer. That is short enough to survive being truncated in search results and shared in chats, while still carrying the keywords that make the page findable.

Can I change a slug after publishing?

Yes, but the old URL stops working the moment you do. Set up a 301 redirect from the old slug to the new one, or every inbound link, bookmark, and search listing that points at the old address will 404.

Related Tools