Last Unicode Character: U+10FFFF and How to Find the Final Code Point
The highest Unicode code point is U+10FFFF, a noncharacter. This guide covers what that means, how it is encoded, and how to find the last code point in a string.
A search for the last Unicode character usually means one of two things. It can mean the highest code point the Unicode standard allows. It can also mean the final character in a specific piece of text. This guide answers both questions and shows how to check each result yourself.
The highest code point in Unicode: U+10FFFF
A code point is the number Unicode gives to one position in its code space. It is written as U+ followed by hexadecimal digits. The code space runs from U+0000 to U+10FFFF, which is 1,114,112 positions. These positions are divided into 17 planes of 65,536 code points each, numbered 0 to 16. Nothing above U+10FFFF is valid. UTF-16 cannot represent anything higher, and UTF-8 is restricted to the same ceiling so that all Unicode encodings cover the same range.
U+10FFFF is not a visible character. It is a noncharacter, which means the standard permanently reserves it for internal use inside software and will never assign it a glyph or meaning. Every plane ends with two noncharacters: U+xxFFFE and U+xxFFFF. The final code point of the whole code space is therefore one of these reserved values.
| Code point | What it is | Can you display it? |
| U+10FFFF | Last code point in Unicode; a noncharacter | No, it is reserved for internal use and has no glyph |
| U+10FFFE | Second-to-last code point; also a noncharacter | No |
| U+10FFFD | Last private-use code point, at the end of Supplementary Private Use Area-B in Plane 16 | Only if a font or application defines it by private agreement |
| U+E01EF | VARIATION SELECTOR-256, in Plane 14 | It is invisible; it modifies the appearance of the character before it |
Planes 15 and 16 are set aside entirely for private use, so the standard itself defines no characters there. In current versions, the highest publicly assigned code point is in Plane 14, which holds tag characters and variation selectors. Character assignments grow with each Unicode release. Because of that, the last assigned character is not a fixed answer. To get the exact answer for your software, check the Unicode Character Database for the Unicode version that your software uses.
How U+10FFFF appears in each encoding
These byte sequences follow from the encoding rules. Use them to recognize the maximum code point in a hex dump or a byte-level inspector.
| Encoding | Bytes or code units for U+10FFFF | Note |
| UTF-8 | F4 8F BF BF | No valid UTF-8 sequence begins with a byte higher than F4 |
| UTF-16 | DBFF DFFF | A surrogate pair, which is the highest possible high surrogate followed by the highest possible low surrogate |
| UTF-32 | 0010FFFF | One 32-bit unit; any value above this is invalid |
The surrogate range, U+D800 to U+DFFF, exists only so that UTF-16 can build these pairs. Surrogates are not characters. A surrogate that appears alone in text is a sign of corruption or of incorrect slicing.
Checking the upper limit step by step
The snippets below are illustrative examples. The comments show the results expected from each language's documented behavior. They were not run for this guide, so run them yourself to confirm them in your own environment.
# Python 3.8 or later
import sys, unicodedata
print(hex(sys.maxunicode)) # expected: 0x10ffff
last = chr(0x10FFFF)
print(unicodedata.category(last)) # expected: Cn (no assigned character)
print(last.encode("utf-8").hex(" ")) # expected: f4 8f bf bf
chr(0x110000) # expected: ValueError, out of range
// JavaScript
const last = String.fromCodePoint(0x10FFFF);
last.length; // expected: 2 (two UTF-16 code units)
[...last].length; // expected: 1 (one code point)
last.codePointAt(0).toString(16); // expected: "10ffff"
String.fromCodePoint(0x110000); // expected: RangeError
If the maximum is reported as 0xffff, or if creating U+10FFFF fails, the tool is probably working in UTF-16 code units rather than in code points. Any further inspection with that tool will split characters outside the Basic Multilingual Plane, the range from U+0000 to U+FFFF.
Finding the last character in a string
If you need to know what sits at the end of a particular text, the answer depends on which unit you count. A code unit is one 16-bit or 8-bit piece of an encoding. A code point is one Unicode number. A grapheme cluster is what a reader sees as one character, and it can contain several code points. These three units can all give different answers for the same string.
# Python: indexing returns the last code point
import unicodedata
s = "cafe\u0301" # displays as "café": e followed by a combining accent
last = s[-1]
print(f"U+{ord(last):04X}", unicodedata.name(last))
# expected: U+0301 COMBINING ACUTE ACCENT
// JavaScript: three different "last characters"
const s = "ok \u{1F44D}\u{1F3FD}"; // thumbs-up emoji plus a skin-tone modifier
s.slice(-1); // expected: "\uDFFD", a lone surrogate
[...s].at(-1).codePointAt(0).toString(16); // expected: "1f3fd", the modifier only
const seg = new Intl.Segmenter("en", { granularity: "grapheme" });
[...seg.segment(s)].at(-1).segment; // expected: the full emoji as one cluster
In both examples the last code point is not what a reader sees as the last character. It is a combining accent in the first case and a skin-tone modifier in the second. If you delete or replace only that code point, you change the visible text, which can mean losing an accent or changing an emoji's skin tone. To edit what the user sees, work with grapheme clusters. In Python, the standard library has no grapheme segmentation, but the third-party regex module supports the \X pattern for this purpose.
Verifying the result
- Print the code point in hexadecimal with the U+ prefix, not the rendered glyph, because invisible or combining characters will not show up clearly.
- Look up its name and general category. Cn means no character is assigned, Co means private use, Mn means a combining mark, and Cs means a surrogate.
- If the category is Cs, you have split a surrogate pair. Re-read the string by code point.
- If the category is Mn or the code point is a modifier or variation selector, take the whole grapheme cluster as the last visible character.
- Confirm that no value exceeds U+10FFFF. Anything higher is invalid input, not a rare character.
Gaps in this guide: no specific inspection tool was tested, and no version-specific data on the newest assigned characters was supplied. Any claim about the last assigned character in a given Unicode release should be checked against that release's character database.