JavaScript String.prototype.normalize() Method
The normalize() method converts a string to a standard Unicode form, so text that looks the same compares as equal.
Description
The normalize() method returns the Unicode normalization form of a string. The same visible text can be stored in different ways: "é" can be a single character or an "e" followed by a combining accent. Normalizing both strings to the same form, usually NFC, makes them compare as equal.
NFD splits accented characters apart, which can be used to strip accents by removing the combining marks.
The "K" forms, NFKC and NFKD, also replace compatibility characters with their plain equivalents, such as turning the ligature "fi" into "fi" and full-width letters into normal ones. That's useful when searching or comparing user input, but it changes how text looks, so don't use those forms on text you'll display or store as the user typed it.
Syntax
string.normalize()
string.normalize(form)Parameters
- formOptional. One of
"NFC"(the default),"NFD","NFKC"or"NFKD".
Return Value
The string in the requested Unicode normalization form.
Example
Browser Support
The following information will show you the current browser support for the String.prototype.normalize() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





