1001Ferramentas
🧬 Text

Unicode Normalizer (NFC/NFD)

Apply Unicode normalization NFC, NFD, NFKC or NFKD to a text. Shows codepoint count before and after.

Antes
Depois

When two identical strings refuse to match

Your database search misses 'ação', a spreadsheet filter skips a row that is visibly there, or a string comparison returns false even though both sides look identical on screen. The cause is almost always the same: an accent can be stored as a single character or as the base letter followed by a combining mark. Paste the text here and see both versions side by side, with counts before and after.

There are four forms. NFC composes (é becomes one codepoint), NFD decomposes (e plus the accent, two codepoints). NFKC and NFKD do that and also apply compatibility mapping: the fi ligature splits into f and i, superscript ² becomes 2, fullwidth A becomes A. That second group is one way, you cannot get the original back. The counters show UTF-16 units (what JavaScript .length returns) and codepoints, which is where the gap shows up.

For storing and comparing in a database, NFC is the usual pick on the web. NFD helps when the next step is stripping diacritics. Think twice before running NFK on technical text: m² turning into m2 and ½ turning into 1⁄2 changes the meaning of the data. This is not an accent remover, accents survive in every form. Normalization runs in your browser, nothing is uploaded.

Frequently asked questions

Which form should I store in the database?
NFC in most cases. It is the recommended form for web content and it keeps string comparison predictable.
Why does the codepoint count change if the text looks the same?
Because a combining accent takes a codepoint of its own. In NFD 'cafe' with an accent is 5 codepoints, in NFC it is 4, and both render identically.
Does NFKC strip accents?
No. It keeps accented letters and only replaces compatibility characters such as ligatures, superscripts, fractions and fullwidth forms.

Related Tools