---
title: "Slugify string"
description: "Free, local Slugify tool to safely convert text into clean URLs. Strip diacritics and punctuation locally in your browser—no data leaves your device."
---

> HTML: https://trendalyzer.app/tools/slugify/
> Index: https://trendalyzer.app/llms.txt

# Slugify string

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.

Readiness: experimental

Input types: text

Output types: text

## Limits

- Removes diacritics via NFKD normalisation; output is ASCII letters, digits, and hyphens only.

## Warnings

- Drops characters that cannot be stripped to ASCII letters or numbers.

## Example

Input: Café au Lait!

Output: cafe-au-lait

## Steps

1. **Paste the title or label** — Enter the phrase you want as a path segment — accents and punctuation are fine.
2. **Run locally** — The engine applies Unicode NFKD, strips combining marks and non-alphanumeric characters, then lowercases and hyphenates.
3. **Copy the slug** — Use the ASCII hyphenated result in a route, filename, or CMS path field.

## 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

```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

```python
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("-")
```

## FAQ



### 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.
