Slugify string
FormatExperimentalLimited support. Verify anything critical.
Slugify turns a phrase into a URL-safe ASCII path: it strips diacritics via Unicode NFKD, drops non-alphanumeric punctuation, lowercases the result, and joins words with hyphens. Use it for blog titles, product names, or other labels that must become a clean web path segment.
Skip to the toolThis tool processes text on your device. The text is not uploaded.
Steps
Paste the title or label
Run locally
Copy the slug
How to use Slugify string
How does it work?
- Unicode NFKD decomposition: Compatibility decomposition separates accented characters (like
éorç) into base characters and diacritical marks, and also maps some compatibility characters toward ASCII-friendly forms. - Diacritic and symbol stripping: Combining marks are removed. Non-Latin scripts and symbols that cannot map to
a-z/0-9are dropped. - Hyphenation and compaction: Spaces and remaining punctuation become hyphens; consecutive hyphens collapse; leading and trailing hyphens are trimmed.
- ASCII-only output: Unlike kebab-case on this site, which may keep Unicode letters, a slug is alphanumeric ASCII only.
Practical developer use cases
- Blog and CMS paths:
"10 Tips for C# Developers!"→10-tips-for-c-developers. - Product identifiers: Normalize user-entered names into catalog slugs.
- Git branch names: Turn ticket titles into terminal-friendly branch segments.
Best practices
Keep published slugs short and stable. Changing a live slug breaks bookmarks unless you add a redirect. Stop words (and, the) can be trimmed before slugifying if you want leaner URLs.
Code examples
JavaScript / TypeScript
function slugify(text: string): string {
return text
.normalize("NFKD")
.replace(/[^\w\s-]/g, "")
.trim()
.replace(/[\s_]+/g, "-")
.replace(/-+/g, "-")
.replace(/^-|-$/g, "")
.toLowerCase();
}Python 3
import unicodedata
import re
def slugify(text: str) -> str:
text = unicodedata.normalize("NFKD", text)
text = "".join(char for char in text if unicodedata.category(char) != "Mn")
text = re.sub(r"[^a-z0-9]+", "-", text.lower())
return text.strip("-")How it works
- Enter what you haveType or pick your text. Nothing is submitted anywhere.
- It runs in this tabThe calculation happens on your device, using your browser's own data.
- Take the resultRead the text, then copy or download.
Reimplemented locally. Not derived from IT-Tools source.
- Basis
- independent
- Licence
- MIT
- Last reviewed
Frequently asked questions
How does Slugify handle accents and diacritics (like é or ç)?
The algorithm applies Unicode NFKD (Normalization Form Compatibility Decomposition) to split characters from their diacritics, then strips combining marks, leaving only the base ASCII letter.
Are non-Latin alphabets (like Cyrillic or Arabic) preserved?
No. Strict slugification drops characters that cannot be decomposed into basic alphanumeric ASCII (a-z, 0-9), rendering it unsuitable for full localized non-Latin URLs.
How does Slugify differ from standard kebab-case?
While both join words with hyphens, Slugify strictly enforces an alphanumeric ASCII-only output, aggressively stripping punctuation, symbols, and non-representable Unicode characters.
Are consecutive hyphens removed?
Yes. Multiple consecutive hyphens (resulting from stripped punctuation) are collapsed into a single hyphen, and leading/trailing hyphens are trimmed from the final output.