---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 23 Edition"
java_version: 23
chapter: "Chapter 3. Lexical Structure"
section: "3.1"
heading: "3.1. Unicode"
parent: "Chapter 3. Lexical Structure"
source: https://docs.oracle.com/javase/specs/jls/se23/html/jls-3.html#jls-3.1
id: "3.1"
url: https://jvm.obfuscated.software/jls/se23/3.1.html
raw: https://jvm.obfuscated.software/jls/se23/3.1.md
---

# 3.1. Unicode

Programs are written using the Unicode character set ([§1.7](1.7.md)). Information about this character set and its associated character encodings may be found at [`https://www.unicode.org/`](https://www.unicode.org/).

The Java SE Platform tracks the Unicode Standard as it evolves. The precise version of Unicode used by a given release is specified in the documentation of the class `Character`.

The Unicode standard was originally designed as a fixed-width 16-bit character encoding. It has since been changed to allow for characters whose representation requires more than 16 bits. The range of legal code points is now U+0000 to U+10FFFF, using the hexadecimal *U+n* notation. Characters whose code points are greater than U+FFFF are called *supplementary characters*. To represent the complete range of characters using only 16-bit units, the Unicode standard defines an encoding called UTF-16. In this encoding, supplementary characters are represented as pairs of 16-bit code units, the first from the high-surrogates range (U+D800 to U+DBFF), and the second from the low-surrogates range (U+DC00 to U+DFFF). For characters in the range U+0000 to U+FFFF, the values of code points and UTF-16 code units are the same.

The Java programming language represents text in sequences of 16-bit code units, using the UTF-16 encoding.

Some APIs of the Java SE Platform, primarily in the `Character` class, use 32-bit integers to represent code points as individual entities. The Java SE Platform provides methods to convert between 16-bit and 32-bit representations.

This specification uses the terms *code point* and *UTF-16 code unit* where the representation is relevant, and the generic term *character* where the representation is irrelevant to the discussion.

Except for comments ([§3.7](3.7.md)), identifiers ([§3.8](3.8.md)), and the contents of character literals, string literals, and text blocks ([§3.10.4](3.10.4.md), [§3.10.5](3.10.5.md), [§3.10.6](3.10.6.md)), all input elements ([§3.5](3.5.md)) in a program are formed only from ASCII characters (or Unicode escapes ([§3.3](3.3.md)) which result in ASCII characters).

ASCII (ANSI X3.4) is the American Standard Code for Information Interchange. The first 128 characters of the Unicode UTF-16 encoding are the ASCII characters.
