Slug
URL Slug Generator — Create SEO-Friendly Slugs Online
Type a blog post title, product name, page heading, or category label and the page renders the URL-safe slug version live underneath. "Café Móvil — 5 Tips & Tricks!" becomes `cafe-movil-5-tips-tricks`, ready to drop into a CMS, route file, or filename. The transform is conservative — only ASCII letters, digits, and hyphens survive — so the slug is safe to use in any URL path segment without further encoding, and stable across operating systems and CMSes that may handle Unicode paths differently. Useful for hand-crafting permalinks before publishing in WordPress, Ghost, Astro, Hugo, or Next.js, generating filenames from human titles, naming images for SEO, or producing identifier strings from labels in a database import.
About this tool
The pipeline runs five passes in order: (1) lowercase via `String.prototype.toLowerCase` (locale-aware Latin lowercase rules — `İ` correctly becomes `i̇` then strips the combining mark in the next pass); (2) NFD Unicode normalization, which decomposes accented characters into base letter + combining diacritic (`á` → `a` + U+0301 combining acute); (3) regex strip of the combining diacritic block (`U+0300-U+036F`), leaving only the base letters; (4) regex strip of everything that isn't lowercase ASCII letter, digit, whitespace, or hyphen — so `é` becomes `e`, `ñ` becomes `n`, but `&`, `?`, `.`, em-dashes, and emoji are dropped; (5) trim, replace runs of whitespace with a single hyphen, then collapse runs of hyphens to a single hyphen. The result is a deterministic, idempotent slug — running it twice produces the same output. Use cases: hand-curating WordPress/Ghost/Astro permalinks before publishing, generating SEO-friendly image filenames, deriving database record identifiers from human-entered names, normalizing tags from a folksonomy, or producing safe filenames for a static-site build.
- Five-pass deterministic pipeline — runs the same way every time
- NFD Unicode normalization handles accents in any script
- Strips combining diacritics (U+0300-U+036F) — keeps base letters
- Drops everything except a-z, 0-9, space, hyphen — safe for any URL
- Collapses repeated whitespace and repeated hyphens to one each
- Trims leading/trailing whitespace before hyphenation
- Reactive — slug updates as you type
- Idempotent — running it on a slug returns the same slug
- One-click copy to clipboard with confirmation
- Useful for permalinks, filenames, DB identifiers, tag normalization, image SEO
Free. No signup. Your inputs stay in your browser. Ads via Google AdSense (consent required).
Frequently asked questions
Why is the slug ASCII-only when modern URLs technically support Unicode?
RFC 3986 (Berners-Lee, Fielding, Masinter; January 2005, IETF / STD 66) defines the unreserved character set as ALPHA / DIGIT / '-' / '.' / '_' / '~' — anything outside that range must be percent-encoded as UTF-8 octets. Modern browsers and servers support Unicode URLs via percent-encoding (so 'café' becomes '%C3%A9' in the path), but the percent-encoded form is hard to read, hard to share verbally, copy-paste fragile across some terminals and email clients, and inconsistently handled by CMSes and analytics systems. ASCII slugs avoid the issue entirely — they survive every encoding boundary, render identically everywhere, and stay short. For internationalized content, modern CMSes typically combine an ASCII slug with a separate Unicode title field rather than encoding the title into the URL itself.
Why is the pipeline idempotent — and why does that matter?
Each pass — lowercase, NFD normalize, strip combining diacritics (U+0300–U+036F), strip non-ASCII-alphanumeric, collapse whitespace and hyphens — is itself idempotent. NFD normalize on already-decomposed text is a no-op; lowercase on already-lowercase ASCII is a no-op; the regex strips have nothing left to remove on a second pass. So `slugify(slugify(x)) === slugify(x)` for all inputs. Idempotency matters for systems that may slugify the same input twice (CMS save → re-render → re-slugify), URL canonicalization (a slug fetched from the database and re-validated should produce itself), and migrations (re-running a slug-generation pass over already-slugified data must be safe).
How does this handle non-Latin scripts like Chinese, Japanese, or Arabic?
NFD canonical decomposition splits characters with a canonical mapping to base + combining marks — primarily Latin, Greek, Cyrillic, and Vietnamese precomposed letter+diacritic forms. CJK ideographs and most Arabic letters are atomic in Unicode and have no canonical decomposition. Korean Hangul precomposed syllables (U+AC00–U+D7A3) DO canonically decompose into Jamo (U+1100–U+11FF) per UAX #15 §10.1 — but those Jamo are then dropped by the next pass — strip everything outside [a-z0-9 -] — so the practical result is the same: '東京', '서울', or 'مرحبا' produce an empty slug, which many CMSes (WordPress, Ghost) fall back to a record ID for. For real internationalized slugs, ICU transliterators (Latin-ASCII transform) or romanization libraries (Hepburn for Japanese, Pinyin for Chinese, Revised Romanization for Korean) provide phonetic ASCII renderings — those are out of scope for a deterministic stripped slug.
What's the difference between this slug generator and case-converter's kebab-case mode?
case-converter's kebab-case applies the same NFD plus combining-diacritic strip step but keeps every alphanumeric character in the result, then joins word boundaries with hyphens — so 'Hello World 2025!' becomes 'hello-world-2025!' (keeps the digits and the trailing exclamation if there's no further filter). slug-generator additionally drops everything that isn't a lowercase ASCII letter, digit, whitespace, or hyphen — so the same input becomes 'hello-world-2025'. The slug is more conservative because URL safety is the constraint, while case-converter's kebab is for code identifiers where 2025 is a fine variable-name component.
How does this tool handle accessibility for screen readers?
The slug output region is marked aria-live="polite", the W3C WCAG Success Criterion 4.1.3 (Status Messages, introduced in WCAG 2.1, Recommendation 5 June 2018; carried unchanged into WCAG 2.2, Recommendation 5 October 2023) pattern. Polite live regions queue announcements after any speech in progress, so editing the title announces the new slug without interrupting the user mid-sentence. Screen readers (NVDA, JAWS, VoiceOver) consume the live region automatically; nothing else is required from the user.
Sources (5)
- Berners-Lee, T., Fielding, R., & Masinter, L. (2005). RFC 3986 / STD 66 — Uniform Resource Identifier (URI): Generic Syntax (unreserved = ALPHA / DIGIT / '-' / '.' / '_' / '~'). Internet Engineering Task Force, January 2005.
- Whistler, K. (Ed.) (2025). UAX #15: Unicode Normalization Forms (NFC, NFD, NFKC, NFKD). Unicode Standard Annex, Revision 57 (Unicode 17.0.0, 30 July 2025).
- The Unicode Consortium (2024). The Unicode Standard, Version 16.0 — Combining Diacritical Marks block (U+0300–U+036F). Unicode Consortium, Mountain View, CA.
- ECMA International (2025). ECMAScript 2025 Language Specification — String.prototype.normalize. ECMA-262, 16th edition, June 2025.
- World Wide Web Consortium (W3C) (2018). Web Content Accessibility Guidelines (WCAG) 2.1 — Success Criterion 4.1.3 Status Messages. W3C Recommendation 5 June 2018; carried unchanged into WCAG 2.2 (Recommendation 5 October 2023).
These are the original publications the formulas in this tool are based on. Locate them by journal name and year on Google Scholar or PubMed.