URL Slug Generator
Convert any string — article titles, product names, multi-language text — into a clean URL-safe slug. Transliterates accents, removes punctuation, lowercases, joins with hyphens (or your chosen separator). Live preview, max-length cap, browser-only.
What Makes a Good URL Slug
The slug is the human-readable part of a URL — the segment after the last / that identifies a specific page. example.com/blog/how-to-bake-bread. It does three jobs: it tells search engines what the page is about (a strong on-page SEO signal), it gives users a sense of the destination before they click, and it persists in shares, link previews, and bookmarks. A clean slug is one of the few SEO controls that's both quick to fix and consequential.
The Rules
- Lowercase. URL paths are case-sensitive on most servers. Mixed-case slugs cause duplicate-content issues and 404s.
- Hyphens, not underscores. Google parses
-as a word separator and_as part of a single token.how-to-bakeindexes as three keywords;how_to_bakeindexes as one weird word. - ASCII only (usually). Non-ASCII characters get percent-encoded in the URL bar and look ugly when shared. Transliterate
étoe,ñton, etc. - No stop words (optional). Some SEO style guides drop "the", "a", "of" — saves length. Most CMSs leave them in.
- Cap at 60–80 characters. Google snippet URLs truncate around there. Trim at word boundaries.
- No trailing punctuation. Trailing hyphens are valid but ugly. The tool strips them.
- Stable. Once a slug is published, changing it breaks every inbound link unless you 301-redirect.
Slugs in Code
// Browser / Node — basic ASCII slug
const slug = s => s
.toLowerCase()
.normalize('NFKD') // split accents from letters
.replace(/[̀-ͯ]/g, '') // remove combining marks
.replace(/[^a-z0-9]+/g, '-') // non-alphanum → hyphen
.replace(/^-+|-+$/g, '') // trim leading/trailing hyphens
.slice(0, 80);
// Python — using slugify
from slugify import slugify
slugify("Café del Niño") // 'cafe-del-nino'
# Ruby on Rails
"Café del Niño".parameterize // 'cafe-del-nino' For most use cases the in-browser tool is enough. For programmatic generation in production code, npm's slugify or Python's python-slugify handle more edge cases (Cyrillic transliteration, custom replacement maps, locale-specific rules).
How to Use
- Paste your title — output updates as you type.
- Pick separator and length — defaults are right for almost everything.
- Toggle 'Keep Unicode' only if your site explicitly uses non-ASCII URLs.
- Copy and paste into your CMS or code.
Frequently Asked Questions
What is a URL slug?
The slug is the readable, ASCII-only part of a URL that identifies a page — for example, in https://example.com/blog/how-to-bake-bread, the slug is 'how-to-bake-bread'. It comes from the article title or product name with all non-URL-safe characters removed and spaces replaced by hyphens. Search engines, users, and link previews all see this string, so making it readable matters for both SEO and click-through rate.
Why are slugs lowercase and hyphenated by convention?
Lowercase because URLs are case-sensitive in the path on most servers — having to remember capitalization is a usability disaster, and search engines may treat /About and /about as distinct pages. Hyphens (-) rather than underscores (_) because Google explicitly treats hyphens as word separators (so 'how-to-bake' is parsed as three keywords) but underscores as part of a single word. Spaces in URLs become %20 which is ugly. Hyphens win on every axis.
How are accented characters and non-Latin scripts handled?
By default the tool transliterates: 'café' → 'cafe', 'mañana' → 'manana', 'jürgen' → 'jurgen'. This is best for SEO because most search-engine indexing still favors ASCII slugs and the resulting URL is universally type-able. Toggle 'Keep Unicode' if you specifically want to preserve non-ASCII (e.g., for Japanese or Chinese site sections); modern browsers handle these via punycode/IDN, but compatibility is mixed and copy-paste behavior varies by tool.
What's the right max length?
60–80 characters is a sensible cap. Google's search snippets truncate URLs around there. WordPress defaults to 200 chars but most CMSs cap around 100. The tool defaults to 80 and trims at word boundaries (no half-cut words). You can override to anything from 20 to 500.
Can I use a different separator?
Yes — toggle to underscore for some legacy systems or Twitter handles, or to no separator for compact identifiers. Hyphens remain the default and are right for almost everything.
Should I include numbers in slugs?
Yes — numbers are URL-safe and useful for unique identifiers. Some sites add IDs to slugs to guarantee uniqueness while keeping the title readable: '/products/macbook-pro-14-inch-A2779'. Keep slug-then-ID convention if you do this — search engines parse the words first.
Comments
No comments yet. Be the first!