Skip to content

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 tool

This tool processes text on your device. The text is not uploaded.

  • Removes diacritics via NFKD normalisation; output is ASCII letters, digits, and hyphens only.
  • Drops characters that cannot be stripped to ASCII letters or numbers.

Steps

Paste the title or label

Enter the phrase you want as a path segment — accents and punctuation are fine.

Run locally

The engine applies Unicode NFKD, strips combining marks and non-alphanumeric characters, then lowercases and hyphenates.

Copy the slug

Use the ASCII hyphenated result in a route, filename, or CMS path field.

How to use Slugify string

How does it work?
  1. 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.
  2. Diacritic and symbol stripping: Combining marks are removed. Non-Latin scripts and symbols that cannot map to a-z / 0-9 are dropped.
  3. Hyphenation and compaction: Spaces and remaining punctuation become hyphens; consecutive hyphens collapse; leading and trailing hyphens are trimmed.
  4. 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

  1. Enter what you haveType or pick your text. Nothing is submitted anywhere.
  2. It runs in this tabThe calculation happens on your device, using your browser's own data.
  3. 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.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close