Friday, September 5, 2025
HomeLanguagesJavascriptJavaScript String normalize() Method

JavaScript String normalize() Method

JavaScript string normalize() is an inbuilt method in javascript which is used to return a Unicode normalization form of a given input string. If the given input is not a string, then at first it will be converted into a string then this method will work.

Syntax: 

string.normalize([form])

Parameters: Here the parameter is formed which is of many types- 

  • NFC: Normalization Form Canonical Composition.
  • NFD: Normalization Form Canonical Decomposition.
  • NFKC: Normalization Form Compatibility Composition.
  • NFKD: Normalization Form Compatibility Decomposition.

These all say the Unicode Normalization Form. 

Return value: It returns a new string containing the Unicode Normalization Form of the given input string.

Below is an example of the string.normalize() method. 

Example 1: This example shows the basic use of the string.normalize() method in Javascript.

javascript




let a = "Geeks For Geeks";
 
b = a.normalize('NFC')
c = a.normalize('NFD')
d = a.normalize('NFKC')
e = a.normalize('NFKD')
 
console.log(b, c, d, e);


Output:  

Geeks For GeeksGeeks For GeeksGeeks For GeeksGeeks For Geeks

Example 2: This example shows the basic use of the string.normalize() method in Javascript.

javascript




// Taking a string as input.
let a = "GeeksForGeeks";
 
// calling normalize method.
b = a.normalize('NFC')
c = a.normalize('NFD')
d = a.normalize('NFKC')
e = a.normalize('NFKD')
 
// Printing normalised form.
console.log(b);
console.log(c);
console.log(d);
console.log(e);


Output: 

GeeksForGeeks
GeeksForGeeks
GeeksForGeeks
GeeksForGeeks

We have a complete list of Javascript string methods, to check those please go through this Javascript String Complete reference article.

Supported Browsers:  

  • Google Chrome 34 and above
  • Edge 12 and above
  • Firefox 31 and above
  • Opera 21 and above
  • Safari 10 and above
RELATED ARTICLES

Most Popular

Dominic
32269 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6638 POSTS0 COMMENTS
Nicole Veronica
11802 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11866 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7027 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS