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
Syntax
string.normalize(form)
Parameters
| Parameter | Description |
|---|---|
form optional |
"NFC", "NFD", "NFKC" or "NFKD". Default: "NFC" |
Return value
A new string.
Examples
const a = "caf\u00e9", b = "cafe\u0301";
console.log(a === b, a.normalize() === b.normalize(), a.length, b.length);
Output
false true 4 5
const stripAccents = (s) => s.normalize("NFD").replace(/\p{Diacritic}/gu, "");
console.log(stripAccents("Crème brûlée"));
Output
Creme brulee
Version history
| Version | Change |
|---|---|
| JavaScript ES2015 | Added |
Related
string.localeCompare()· Compare two strings using language rules; returns a negative number, 0 or a positive number. Use it to sort names.string.isWellFormed()· Return true if the string has no lone surrogates, i.e. it can be safely encoded as UTF-8.- JavaScript Strings · tutorial
- JavaScript String Methods · tutorial