deburr()
deburr(
str):string
Removes diacritical marks and converts ligatures to basic Latin letters.
💎 Why is this a Hidden Gem?
Removes accents and expands ligatures (e.g., "æ" → "ae"), enabling ASCII-safe comparisons and search indexing.
Uses NFD normalization. Expands ligatures (œ→oe, ß→ss, æ→ae, Þ→Th, etc.).
Parameters
str: string
The string to deburr.
Returns: string
The deburred string.
Since
2.0.0
Performance
O(n) time where n is string length. Uses native normalize() and object lookup for ligatures.
Also known as
deburr (Lodash, es-toolkit, Modern Dash) · ❌ (Remeda, Radashi, Ramda, Effect, Antfu)
Example
deburr('café'); // => 'cafe'
deburr('Müller'); // => 'Muller'
deburr('Straße'); // => 'Strasse'
deburr('Œuvre'); // => 'OEuvre'
deburr('Þór'); // => 'Thor'
deburr('Łódź'); // => 'Lodz'
How it works?
Removes diacritical marks and converts ligatures to basic Latin letters.
Process
Ligature Expansion
| Input | Output |
|---|---|
œ | oe |
æ | ae |
ß | ss |
Þ | Th |
Ø | O |
Examples
| Input | Output |
|---|---|
café | cafe |
Müller | Muller |
Straße | Strasse |
Œuvre | OEuvre |
Þór | Thor |
Łódź | Lodz |
Use Cases
Sanitize search queries 📌
Normalize user input for search indexing or comparison. Essential for building resilient search features that handle international characters.
const query = deburr('Crème Brûlée'); // 'Creme Brulee'
Generate URL slugs from international text
Strip diacritics before generating URL-safe slugs. Essential for multilingual apps where titles contain accented characters.
const toSlug = (title: string) =>
deburr(title).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
toSlug('Café résumé — été 2025');
// => 'cafe-resume-ete-2025'
Normalize strings for fuzzy search matching
Remove accents before comparing strings so users can search without typing diacritics.
const normalize = (s: string) => deburr(s).toLowerCase();
const products = ['Gruyère', 'Comté', 'Beaufort', 'Époisses'];
const query = 'comte';
const results = products.filter((p) => normalize(p).includes(normalize(query)));
// => ['Comté']