JavaScript .normalize()

Anonymous contributor's avatar
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.

  • 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

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 character
const word2 = '\u0065\u0301'; // e + ́ (combining acute)
console.log(word1 === word2);
console.log(word1.normalize() === word2.normalize());

The output of this code is:

false
true

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:

Code
Output
Loading...

All contributors

Contribute to 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