Skip to main content

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.

note

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​

InputOutput
œoe
æae
ßss
ÞTh
ØO

Examples​

InputOutput
cafécafe
MüllerMuller
StraßeStrasse
ŒuvreOEuvre
ÞórThor
Łó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é']

Normalize user names for avatar initials​

Strip accents before extracting initials for avatar placeholders. Essential for design systems with initial-based avatar components.

const getInitials = (name: string) =>
deburr(name)
.split(" ")
.map((part) => part[0])
.join("")
.toUpperCase();

getInitials("Rene Descartes"); // => "RD"
getInitials("Jose Garcia"); // => "JG"

Build search index entries​

Deburr product names and descriptions before indexing for search. Critical for e-commerce search engines handling multilingual catalogs.

const buildSearchEntry = (product) => ({
id: product.id,
searchText: deburr(`${product.name} ${product.description} ${product.category}`).toLowerCase(),
original: product,
});

const searchIndex = products.map(buildSearchEntry);

// Search matches "creme" even if product is "Creme"
const results = searchIndex.filter((entry) =>
entry.searchText.includes(deburr(query).toLowerCase())
);