A code point is a numeric position in the Unicode code space. A Unicode scalar value is a code point except the surrogate range U+D800 through U+DFFF. UTF-16 is an encoding form made from 16-bit code units, so one scalar value does not always occupy one JavaScript string position. Keeping these units separate prevents misleading counts and broken iteration.

BMP values use one UTF-16 unit

Most commonly encountered writing systems and symbols are in the Basic Multilingual Plane. A scalar from U+0000 through U+D7FF or U+E000 through U+FFFF is represented by one UTF-16 unit with the same hexadecimal value. The gap exists because D800 through DFFF are reserved for pairs, not standalone characters. UnicodeLens accepts valid BMP scalars, including controls and private-use values, but does not assign them names or meanings.

Supplementary values form a surrogate pair

For a scalar at U+10000 or above, UTF-16 subtracts 0x10000 and distributes the remaining bits across one high surrogate and one low surrogate. The emoji ๐Ÿ˜€ is U+1F600 but its UTF-16 units are D83D DE00. JavaScript therefore reports a string length of two for that value. UnicodeLens reports one scalar row, two UTF-16 units and four UTF-8 bytes so every measurement names its unit instead of calling all three characters.

An isolated surrogate is not a scalar value

A high surrogate without an immediate low surrogate, or a low surrogate without its high partner, is ill-formed UTF-16. Some platform APIs silently replace such input before encoding, which hides the original defect. UnicodeLens stops at the one-based UTF-16 unit position and leaves no stale result. Decode mode also refuses U+D800 through U+DFFF tokens because those numbers identify surrogate code points, not values that can independently become UTF-8 text.