code point
termKept in this browser · My desk
A value in the Unicode codespace, an integer from 0 to 10FFFF hexadecimal, written U+0041 and so on; not every code point is assigned to a character.
Encodings turn code points into bytes: UTF-8 (a Unicode transformation format) writes one in one to four bytes, UTF-16 in one or two 16-bit units. The range U+D800 to U+DFFF holds the surrogate code points, reserved for the pairs UTF-16 uses and not characters on their own, which is why UTF-8 never encodes them. A Python str is a sequence of code points, so len() of a text counts code points, not the bytes it will take on the wire.
The Unicode Standard defines the term in two lines of its conformance chapter: the Unicode codespace is the range of integers from 0 to 10FFFF hexadecimal (definition D9), and a code point, also called a code position, is any value in that codespace (D10). That makes 1,114,112 code points in all. The usual way to name one is its value in hexadecimal with a U+ prefix, often followed by the character's official name to remove any doubt, as in U+0061 LATIN SMALL LETTER A. A code point is a number, not a character and not a byte: whether it holds a character, and how it is stored, are separate questions answered by the character repertoire and by the encoding form. The glossary keeps a second, older sense as well, a value or position for a character in any coded character set, which is why people speak of code points in ASCII (American Standard Code for Information Interchange) or in a Windows code page.
Every code point belongs to one of seven types (D10a): graphic, format, control, private-use, surrogate, noncharacter and reserved. Only the first four represent abstract characters. Sixty-five code points, U+0000 to U+001F and U+007F to U+009F, are control codes kept for compatibility with the older C0 and C1 control sets. Sixty-six are noncharacters, U+FDD0 to U+FDEF plus every code point whose last four hexadecimal digits are FFFE or FFFF, permanently reserved for internal use such as sentinel values; they are well formed in every encoding form but are not meant for interchange. Private-use code points have meanings agreed privately, with 6,400 of them in the first plane and 131,068 more in planes 15 and 16. Reserved code points are unassigned today and may be assigned in any future version, which is why software should not treat an unassigned code point as an error in itself.
The codespace is a single range, but it is convenient to divide it into 17 planes of 65,536 code points each, numbered 0 to 16: the last four hexadecimal digits give the position inside the plane and the remaining digits give the plane, so U+23456 sits at position 3456 in plane 2. The Basic Multilingual Plane (BMP, plane 0) holds the common-use characters of all modern scripts and the large majority of real text. The Supplementary Multilingual Plane (SMP, plane 1) takes historic scripts, lesser-used contemporary ones, notational systems and pictographic sets, from Gothic and Shavian to Musical Symbols and Domino Tiles. The Supplementary Ideographic Plane (SIP, plane 2) and Tertiary Ideographic Plane (TIP, plane 3) hold additional, mostly rare ideographs; the Supplementary Special-purpose Plane (SSP, plane 14) holds format controls, tag characters and variation selectors; planes 15 and 16 are for private use. Unicode 18.0.0, released on 16 September 2026, added 13,007 characters for a total of 172,808, including three new scripts (Proto-Cuneiform numerals, Jurchen and Seal), so even now well under a fifth of the codespace holds characters.
Surrogates are the code points that exist because of UTF-16. The high-surrogate range is U+D800 to U+DBFF (D71) and the low-surrogate range U+DC00 to U+DFFF (D73), and a Unicode scalar value is defined as any code point except those (D76). The encoding forms are defined over scalar values, not over all code points. UTF-16 (D91) writes each scalar value from U+0000 to U+D7FF and from U+E000 to U+FFFF as a single 16-bit code unit of the same value, and each value from U+10000 to U+10FFFF as a surrogate pair, a high surrogate followed by a low one; the standard's own example encodes U+10302 as D800 followed by DF02. UTF-8 (D92) assigns each scalar value a sequence of one to four bytes, so a surrogate code point has no UTF-8 form at all; a lone surrogate written out in a UTF-8 stream is not a character but an ill-formed sequence, which conformance clause C9 forbids a process to emit and which decoders replace with U+FFFD. The three forms, UTF-8, UTF-16 and UTF-32, are the Unicode transformation formats (UTF), and the code point is what they have in common. The standard's own example is the sequence U+004D, U+0430, U+4E8C, U+10302: in UTF-8 it takes one, two, three and four bytes (4D, D0 B0, E4 BA 8C, F0 90 8C 82), and in UTF-16 three single units and one surrogate pair.
Programming languages expose the distinction in different places. A Python str is an immutable sequence of Unicode code points, so len() counts code points, indexing returns one code point at a time, and the number of bytes on the wire appears only after encode() chooses a format. Languages and platforms built on UTF-16 count 16-bit code units instead, so a character outside the BMP has a length of two there and one in Python; and neither count is what a user perceives as a single character when combining marks or emoji sequences put several code points under one visible glyph. Bugs live in the gaps between those three units: truncating at a byte or code unit boundary that splits a sequence, comparing strings that look identical but differ in code points, or validating one representation and processing another.
The security consequences follow from the size of the repertoire. Unicode Technical Report (UTR) #36 on security considerations, stabilized and unmaintained since its last revision of 19 September 2014 and now partly superseded by Unicode Technical Standards (UTS) #39 and #55 and Unicode Standard Annex (UAX) #31, describes visual spoofing: an email link to citibank.com that is really a different domain because its first letter is a Cyrillic code point drawn exactly like a Latin c. It notes that the problem predates Unicode, since paypaI.com with a capital I fooled people in plain ASCII, but that a repertoire then of over 107,000 characters multiplies the opportunities. Two strings are visually confusable when they differ in code points yet look alike at small sizes on a screen. UTS #39 on security mechanisms, version 18.0.0 of 27 August 2026, gives the mechanical test: compute each string's skeleton by normalizing it, removing default-ignorable code points and replacing every character with its prototype from the confusables data, and two strings are confusable exactly when their skeletons are equal. It separates single-script, mixed-script and whole-script confusables, with paypal against a version using U+0430 CYRILLIC SMALL LETTER A as the mixed case and scope spelled entirely in Cyrillic as the whole-script one, and defines restriction levels, from ASCII-Only through Highly Restrictive to Moderately Restrictive, for deciding which mixtures of scripts an identifier may contain.
Code points can also mislead without looking like anything. Common Vulnerabilities and Exposures (CVE) entry CVE-2021-42574, the Trojan Source issue published on 1 November 2021 with a CVSS (Common Vulnerability Scoring System) 3.1 score of 8.3, describes how the bidirectional control characters let source code be rendered in an order different from the logical order a compiler reads, so that a reviewer approves code that does something else. The Unicode Consortium's own description of the problem points to UTR #36, UTS #39, UAX #31 on identifiers and rule HL4 of UAX #9, the bidirectional algorithm, for mitigations. The working habit that follows is the same for spoofed domains, hidden characters in configuration files and filter evasion: when text matters, inspect it as a list of code points rather than as glyphs, and decide explicitly which code points an identifier, hostname or policy field may contain.
Also known as: Unicode code point, codepoint, U+ notation
Sources
- Unicode Glossary (read 2026-11-12): code point, any value in the codespace from 0 to 10FFFF, not all assigned to encoded characters, and a position for a character in any coded character set; code point type; high- and low-surrogate code points; plane as 65,536 contiguous code points numbered 0 to 16 (first read for the entry on 2026-10-27)
- Python documentation, Built-in Types (read 2026-11-12): strings are immutable sequences of Unicode code points (first read for the entry on 2026-10-27)
- The Unicode Standard, Version 18.0, Chapter 3, Conformance (read 2026-11-12): D9 codespace, D10 code point (also code position), D10a the seven code point types, D71 and D73 high- and low-surrogate ranges, D76 Unicode scalar value, D91 UTF-16 with the example of U+10302 as D800 DF02, D92 UTF-8 as one to four bytes per scalar value, C9 on ill-formed sequences
- The Unicode Standard, Version 18.0, Chapter 2, General Structure (read 2026-11-12): 1,114,112 code points; the U+ convention with the character name; the table of code point types; 65 control codes; 66 noncharacters; private use in the BMP and planes 15 and 16; the planes and their purposes; Unicode transformation formats
- Unicode, Unicode 18.0.0, 16 September 2026 (read 2026-11-12): 13,007 characters added for a total of 172,808; three new scripts, Proto-Cuneiform numerals, Jurchen and Seal
- Unicode Technical Report #36, Unicode Security Considerations, revision 15, 19 September 2014 (read 2026-11-12): visual spoofing with a Cyrillic letter that looks like c; paypaI.com with a capital I as the pre-Unicode case; visually confusable strings; stabilized, not maintained since 2014 and partly superseded by UTS #39, UTS #55 and UAX #31
- Unicode Technical Standard #39, Unicode Security Mechanisms, version 18.0.0, 27 August 2026, Josh Hadley and Roozbeh Pournader (read 2026-11-12): the skeleton transform and the definition of confusable strings; single-script, mixed-script and whole-script confusables with the paypal and scope examples; bidiSkeleton; restriction levels from ASCII-Only to Moderately Restrictive
- NIST NVD, CVE-2021-42574, published 1 November 2021 (read 2026-11-12): the Unicode bidirectional algorithm permits visual reordering through control characters so that source code renders differently from the order compilers read; CVSS 3.1 base score 8.3; the Unicode Consortium's alternative description pointing to UTR #36, UTS #39, UAX #31 and HL4 of UAX #9