Unicode normalization forms: NFC, NFD, NFKC and NFKD

How NFC, NFD, NFKC and NFKD differ, what NFKC normalization changes in stored text, and when it helps or hurts readability, search and copy/paste.

Unicode normalization converts text into a consistent sequence of code points so that strings that should match actually do. The Unicode Standard (Annex #15) defines four forms: NFC, NFD, NFKC and NFKD. They are often treated as interchangeable settings, but two of them can permanently change what your text says. This review covers what each form does, how NFKC normalization in particular affects styled or decorative text, and how to decide whether a given form fits your workflow.

Short answer: which form should you use?

  • Use NFC for storing and displaying text. It keeps the visible content intact and is the form generally recommended for web content.
  • Use NFD when a process needs base letters and accents as separate code points, such as stripping diacritics or certain sorting steps, and then usually convert back to NFC.
  • Use NFKC for matching, not for storage: search keys, identifiers, deduplication and comparisons where 'looks like the same letter' should count as equal.
  • Use NFKD when you need that same compatibility folding but also want accents separated.
  • Keep the original text whenever you apply NFKC or NFKD, because the compatibility forms are lossy and cannot be reversed.

The two ideas behind all four forms

The forms are built from two independent choices. The first is the type of equivalence: canonical or compatibility. The second is whether the result is composed (C) or decomposed (D).

Canonical equivalence covers sequences that represent the same character and should look and behave identically. The letter é can be stored as one precomposed code point (U+00E9) or as a plain e followed by a combining acute accent (U+0065 U+0301). Both are the same text; canonical normalization just picks one spelling.

Compatibility equivalence is broader. It treats characters as equivalent when they share an underlying meaning but differ in formatting or presentation: the ligature fi and the two letters fi, a superscript ² and the digit 2, fullwidth A and ordinary A. These are not the same text in the strict sense, so folding them removes information.

Form | Equivalence applied | Output shape | Changes visible content?
NFC | Canonical only | Composed | No
NFD | Canonical only | Decomposed | No
NFKC | Canonical and compatibility | Composed | Yes, for compatibility characters
NFKD | Canonical and compatibility | Decomposed | Yes, for compatibility characters

NFC vs NFKC, and NFD vs NFKD

The difference between NFC and NFKC is the same as the difference between NFD and NFKD: the K forms add compatibility folding on top of canonical normalization. NFC will leave fi, ², ① and ™ alone; NFKC turns them into fi, 2, 1 and TM. If your text contains no compatibility characters, NFC and NFKC produce identical output, which is why the difference is easy to miss in casual testing.

NFKD vs NFKC is only a question of shape. Both apply the same folding; NFKD leaves accents as separate combining marks, while NFKC recomposes them where a precomposed character exists.

What the transformation actually changes

Normalization changes the stored code points, not the font, CSS or display direction. It does not reverse, mirror or restyle anything. That matters because the word 'font' is often used loosely for text generators that produce bold, italic, script or circled letters. Those generators do not apply a font; they substitute different Unicode characters, such as Mathematical Bold Capital A (U+1D400) in place of A. Many of those substitutes have compatibility mappings, so NFKC converts them back to plain letters.

Input | Code points | NFC | NFD | NFKC | NFKD
é (precomposed) | U+00E9 | U+00E9 | U+0065 U+0301 | U+00E9 | U+0065 U+0301
Å (Angstrom sign) | U+212B | U+00C5 | U+0041 U+030A | U+00C5 | U+0041 U+030A
fi (ligature) | U+FB01 | unchanged | unchanged | f i | f i
² (superscript two) | U+00B2 | unchanged | unchanged | 2 | 2
A (fullwidth A) | U+FF21 | unchanged | unchanged | A | A
𝐀 (mathematical bold A) | U+1D400 | unchanged | unchanged | A | A
½ (vulgar fraction) | U+00BD | unchanged | unchanged | 1 ⁄ 2 (U+0031 U+2044 U+0032) | 1 ⁄ 2 (U+0031 U+2044 U+0032)
™ (trade mark sign) | U+2122 | unchanged | unchanged | T M | T M

Two rows are worth noticing. The Angstrom sign is changed even by NFC, because it has a canonical singleton mapping to Å; the canonical forms are not always a no-op on visible characters, they just never change meaning. And ½ under NFKC becomes 1, a fraction slash (U+2044) and 2, not the ASCII slash, so a search for '1/2' still may not match.

NFKC does not undo every kind of decorative text. Upside-down generators typically use look-alike characters such as ɐ (U+0250) or ǝ (U+01DD), which are separate letters with no compatibility mapping, so they survive NFKC unchanged. Visually reversed or mirrored text made with CSS or bidirectional controls is a display effect on top of ordinary characters, so normalization has nothing to fold. NFKC also does not fold case (that is a separate operation, sometimes combined as NFKC_Casefold) and does not merge cross-script look-alikes such as Cyrillic а (U+0430) and Latin a.

Why decomposed forms matter for reversal tools

If a reverse-text tool flips a string code point by code point, the normalization form of the input changes the result. In NFD, é is e followed by U+0301; reversing those two puts the accent before the letter, where it attaches to whatever precedes it or renders as a dangling mark. In NFC, the same é is a single code point and survives a naive reversal, but other combinations without a precomposed form will still break. Emoji sequences joined with zero-width joiners or skin-tone modifiers are not altered by normalization at all, yet they split apart under code-point reversal just the same. A reliable reversal tool should reverse by grapheme cluster rather than relying on any normalization form to protect it.

Trying the forms yourself

Most languages expose normalization directly. In Python it is unicodedata.normalize; in JavaScript it is String.prototype.normalize, which defaults to NFC when no form is given. Printing code points rather than rendered text is the most dependable way to see what changed.

import unicodedata

s = "\uFB01 \u00B2 \U0001D400 e\u0301"
for form in ("NFC", "NFD", "NFKC", "NFKD"):
    out = unicodedata.normalize(form, s)
    print(form, [f"U+{ord(c):04X}" for c in out])
const s = "\uFB01 \u00B2 e\u0301";
for (const form of ["NFC", "NFD", "NFKC", "NFKD"]) {
  const cps = [...s.normalize(form)].map(c => "U+" + c.codePointAt(0).toString(16).toUpperCase().padStart(4, "0"));
  console.log(form, cps.join(" "));
}

Will the result stay readable and usable after copying or sharing?

Normalized text is ordinary Unicode, so it copies and pastes like any other text. The practical questions are about what gets lost and what other systems do with it.

  • Copy/paste: the normalized characters are what gets copied. After NFKC, styled letters, ligatures and superscripts are gone for good; pasting them elsewhere will not bring the styling back.
  • String length and offsets: normalization can change the number of code points (fi becomes two, é in NFD becomes two). Any stored positions, character limits or highlight ranges computed before normalization may no longer line up.
  • Meaning: compatibility folding can change semantics. x² becomes x2, and H₂O becomes H2O. For math, chemistry, footnote markers or units, NFKC can turn correct text into misleading text.
  • Search and matching: NFKC helps queries match text typed with fullwidth characters, ligatures or styled letters. Whether a specific search engine or database already applies it is not something this article can confirm; check the system's documentation.
  • Identifiers: some systems apply NFKC automatically. Python, for example, normalizes identifiers in source code with NFKC, so two names that differ only by a compatibility character are treated as the same name.
  • Editing: NFD text can behave unexpectedly in editors, since backspace or cursor movement may act on the accent separately from its base letter depending on the application.

Accessibility is the clearest case for normalizing toward plain characters. Text built from mathematical alphanumeric symbols or other substitutes may be announced character by character, by formal character names, or skipped, depending on the screen reader and platform. No scoped screen reader tests were supplied for this article, so specific behavior in named assistive technologies is not claimed here. The safe conclusion is limited: plain letters are the representation assistive technology is designed around, and decorative substitutes are not.

When plain text is the better choice

If you are tempted to use styled Unicode letters for emphasis in a post, profile or message, writing plain text and using the platform's own formatting is preferable whenever it exists. It stays readable to screen readers, searchable, and unchanged if a downstream system applies NFKC. When you do need to keep decorative or technical characters, store the original, normalize to NFC for storage and display, and generate an NFKC copy only as a matching key.

Verdict

NFKC normalization is well suited to comparison tasks: deduplicating usernames, building search indexes, and reducing styled or fullwidth characters to the letters a reader would recognize. Its decisive tradeoff is that it discards distinctions that are sometimes meaningful, and the loss is permanent. NFC is the safer default for anything people will read or edit, and NFD is a working form rather than a storage form. Gaps to keep in mind: this review is based on the documented behavior of the forms, not on tests in particular apps, platforms or assistive technologies, so confirm behavior in the specific destination before relying on it.