NFKC (Normalization Form KC) is the most aggressive Unicode normalisation form. It goes beyond NFC’s canonical equivalence and additionally folds compatibility variants — full-width letters, ligatures, superscripts, circled characters, and styled look-alikes — into their plain equivalents, then composes combining marks. Use it when you want visually different but semantically equivalent text to be treated as the same string.
NFC vs NFKC: what is the difference?
Both forms handle combining marks. The key difference is compatibility decomposition:
| Operation | NFC | NFKC |
|---|---|---|
Compose e + ◌́ → é | Yes | Yes |
Fold fi → fi | No | Yes |
Fold A (full-width A) → A | No | Yes |
Fold ² (superscript) → 2 | No | Yes |
Fold ① (circled digit) → 1 | No | Yes |
Fold ™ (trademark) → TM | No | Yes |
| Reversible | Yes | No |
NFC only deals with canonical equivalence — two encodings of the same character. NFKC additionally handles compatibility equivalence — characters that have the same basic meaning but different visual presentation. This makes NFKC lossy: the original styling cannot be recovered.
What gets folded under NFKC
Full-width and half-width forms. Characters in the Halfwidth and Fullwidth Forms block (U+FF00–U+FFEF) — such as A (U+FF21), a (U+FF41), 1 (U+FF11) — are folded to their ASCII equivalents A, a, 1. These appear in East Asian text layout where characters occupy a full double-width cell.
Ligatures. fi (U+FB01), fl (U+FB02), ff (U+FB00), ffi (U+FB03), ffl (U+FB04), ſt (U+FB05), st (U+FB06) all decompose into their constituent letters.
Superscripts and subscripts. Mathematical superscripts like ² (U+00B2), ³ (U+00B3), ¹ (U+00B9) and the full Superscript/Subscript block (U+2070–U+209F) fold to plain digits and letters.
Circled characters. ①–⑳, Ⓐ–Ⓩ and similar enclosed/circled variants fold to their base digits and letters.
Fraction forms. ½ (U+00BD) → 1⁄2, ¼ (U+00BC) → 1⁄4, and so on.
The security case for NFKC
Because compatibility variants are visually similar to plain text but technically different code points, they are used in homograph attacks and filter bypasses. A username example (with full-width e) looks identical to example but is a different string. NFKC normalising usernames, email addresses, and search queries before comparison or storage prevents this class of attack.
Unicode Security Mechanisms (Unicode Technical Report #36) recommends NFKC (often combined with casefolding) as part of the standard preprocessing pipeline for identifiers.
How the tool works
NFKC is implemented via the browser’s native String.prototype.normalize("NFKC"), which applies the full Unicode compatibility decomposition mapping followed by canonical composition. The result can have more characters than the input (a two-character ligature becoming two letters) or fewer (combining sequences composing into precomposed forms).
Example
| Input | NFKC output | What happened |
|---|---|---|
file | file | fi ligature → fi |
Apple | Apple | Full-width A → A |
H₂O | H2O | Subscript 2 → 2 |
10² | 102 | Superscript 2 → 2 |
①②③ | 123 | Circled digits → digits |
e + ◌́ | é | Base + combining mark → precomposed |
Because NFKC is not reversible, use it for matching and comparison, not for round-tripping display text you need to preserve. For canonical-only normalisation that keeps visual styling intact, use the NFC tool. All processing runs locally — nothing is uploaded.