String.prototype.normalize
Returns the Unicode Normalization Form of the string
Syntax
string.normalize(form?)Parameters
| Parameter | Type | Description |
|---|---|---|
| form | 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | Unicode normalization form. Defaults to NFC |
Return Value
A string containing the normalized form
Examples
const str1 = '\u00F1'; // ñ
const str2 = '\u006E\u0303'; // ñ (n + combining tilde)
console.log(str1 === str2); // false
console.log(str1.normalize() === str2.normalize()); // trueconst accented = 'caf\u00E9';
const decomposed = accented.normalize('NFD');
console.log(decomposed.length); // 5const str = '\uFB01'; // fi ligature
console.log(str.normalize('NFKD')); // 'fi'Understanding String.prototype.normalize
The String.prototype.normalize method in JavaScript returns the Unicode Normalization Form of the string. It belongs to the String object and is one of the most widely used methods for working with string values in modern JavaScript and TypeScript applications.
The method signature is string.normalize(form?). It accepts 1 parameter: form. When called, it returns a string containing the normalized form. Understanding when and how to use normalize() helps you write more expressive, readable code.
Common use cases for String.prototype.normalize include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like string-localecompare, string-tolowercase, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for String.prototype.normalize is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
More String Methods
Other methods in the String object
Related Tools
More String Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.