JavaScript .normalize()
Anonymous contributor
Published Aug 7, 2025
Contribute to Docs
The .normalize() method in JavaScript returns the Unicode Normalization Form of a string. This is especially useful when comparing strings that may look identical but are composed of different Unicode code points.
Syntax
string.normalize([form])
Parameters:
form(Optional): A string specifying the Unicode normalization form. Valid values are:'NFC'(Default): Canonical Composition'NFD': Canonical Decomposition'NFKC': Compatibility Composition'NFKD': Compatibility Decomposition
Return value:
A new string in the specified normalization form.
Example: Comparing Unicode Representations
In this example, two visually identical strings have different Unicode encodings, and .normalize() is used to make them comparable:
const word1 = '\u00e9'; // é as single characterconst word2 = '\u0065\u0301'; // e + ́ (combining acute)console.log(word1 === word2);console.log(word1.normalize() === word2.normalize());
The output of this code is:
falsetrue
Codebyte Example: Stripping Accents Using Normalize + Regex
In this codebyte example, .normalize() is combined with a regular expression to strip accents by removing Unicode diacritical marks:
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn JavaScript on Codecademy
- Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
- Includes 34 Courses
- With Professional Certification
- Beginner Friendly.115 hours
- Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
- Beginner Friendly.15 hours