JavaScript (ES2026) reference · String Methods

JavaScript String normalize() Method

Return the Unicode normalization form of a string so visually identical text compares equal (NFC, NFD, NFKC, NFKD).

JavaScript (ES2026) Since ES2015

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

string.normalize(form)

Parameters

ParameterDescription
form optional "NFC", "NFD", "NFKC" or "NFKD". Default: "NFC"

Return value

A new string.

Examples

Make equal-looking text equalTry it yourself
const a = "caf\u00e9", b = "cafe\u0301";
console.log(a === b, a.normalize() === b.normalize(), a.length, b.length);

Output

false true 4 5
Remove accents for searchTry it yourself
const stripAccents = (s) => s.normalize("NFD").replace(/\p{Diacritic}/gu, "");
console.log(stripAccents("Crème brûlée"));

Output

Creme brulee

Version history

VersionChange
JavaScript ES2015Added

Was this page helpful?