Letras Diferentes
Unicode research · Superscripts and subscripts

Unicode Superscripts and Subscripts: Encoded Repertoire, Missing Letters and Math Semantics

A rigorous guide to superscript and subscript Unicode digits, modifier letters, incomplete alphabets, NFKC, CSS/MathML alternatives and safe copyable-text mapping.

Technical referenceUnicode baseline: 18.0.0

Encoded raised characters versus real text layout

There are two distinct ways to display raised and lowered text. An application can use ordinary characters positioned with a layout system (such as HTML <sup> and <sub>, CSS baseline shifts or MathML scripts), or it can use Unicode characters whose glyphs are themselves conventionally superscript or subscript forms. These approaches may look similar, but their underlying content differs.

The encoded digit ² is U+00B2 SUPERSCRIPT TWO. In contrast, a 2 rendered as a superscript with HTML remains U+0032 DIGIT TWO in the DOM text. The encoded superscript can survive plain-text copying without markup, but it has limited repertoire and compatibility-normalization behavior. Real mathematical layout can raise arbitrary expressions and preserve structural relationships that Unicode standalone superscript characters cannot represent.

Historically, Unicode retained superscript and subscript symbols for compatibility with existing encodings, linguistic modifier letters, phonetic notation, and certain common scientific or technical uses. The standard deliberately does not encode a complete raised and lowered duplicate of every ordinary writing system's repertoire. A “full superscript alphabet” generator that fills gaps with vaguely similar characters is likely to misrepresent some letters or produce inconsistent results.

Architectural decision: For a controllable document or equation, use structured markup/layout. For a plain-text field, Unicode supplies some genuine raised/lowered characters but not a universal layout mechanism.

Complete superscript and subscript digit sets

Decimal superscript digits are distributed across several Unicode locations. The superscript glyphs for 1, 2 and 3 are historical Latin-1 characters, while superscript 0 and digits 4–9 occur in the Superscripts and Subscripts block. The ten basic subscript digits are contiguous from U+2080 through U+2089. Therefore a single arithmetic offset cannot generate all superscript digits correctly, but an explicit ten-entry map can.

Ordinary digitSuperscriptUnicode code pointSubscriptCode point
0⁰U+2070₀U+2080
1¹U+00B9₁U+2081
2²U+00B2₂U+2082
3³U+00B3₃U+2083
4⁴U+2074₄U+2084
5⁵U+2075₅U+2085
6⁶U+2076₆U+2086
7⁷U+2077₇U+2087
8⁸U+2078₈U+2088
9⁹U+2079₉U+2089

These symbols are valid Unicode characters with dedicated code points. They are not guaranteed to align visually like a typeset superscript exponent in all fonts, and their use is not interchangeable with arbitrary placement of larger mathematical expressions. For example, the encoded sequence x² may communicate a simple exponent in prose; a structured equation needs grouping, precedence and layout information when expressions become complex.

Why the superscript/subscript alphabets are incomplete

Unicode includes modifier letters, phonetic superscript letters and a narrower set of subscript letters spread across several blocks. Examples include U+1D43 ᵃ MODIFIER LETTER SMALL A, U+207F ⁿ SUPERSCRIPT LATIN SMALL LETTER N, U+1D2C ᴬ MODIFIER LETTER CAPITAL A, U+2093 ₓ LATIN SUBSCRIPT SMALL LETTER X, and U+1D62 ᵢ LATIN SUBSCRIPT SMALL LETTER I. These names and properties reflect different linguistic and scientific uses, not one uniform font-substitution alphabet.

A superscript-looking character could belong to General_Category=Lm (modifier letter), No (other number), Sm (mathematical symbol), or another class. Appearance is not an adequate basis for assembling a mapping. Some letters have no standardized corresponding superscript or subscript code point. The glyph designer may also choose a letterform that is unconventional in ordinary English typography because the encoded character originated in phonetics.

Suppose a tool is asked to write "SUBSCRIPT" as fully lowered text. It may have to leave several letters in their ordinary form, choose unsuitable lookalike symbols from unrelated scripts, or use HTML/CSS instead. The technically correct choice is to disclose the repertoire limit and either preserve missing letters or switch to actual markup when the destination permits it.

Unicode normalization data can help reveal compatibility relationships but does not prove that a character belongs to a legitimate complete subscript alphabet. Some modifier symbols have linguistic functions rather than mere presentation purposes. Stripping or rewriting them can change phonetic content.

Operators, signs, fractions and mathematical meaning

Unicode also encodes a modest range of superscript and subscript operators, including superscript plus U+207A ⁺, minus U+207B ⁻, equals U+207C ⁼, and parentheses U+207D ⁽, U+207E ⁾. Corresponding subscript operators occupy U+208A..U+208E. Their placement convention is reflected in their character identity, but these do not constitute a general mathematical grammar.

Consider the notation 10⁻³: the superscript minus is not the ordinary ASCII hyphen-minus U+002D. Under NFKC, it maps to U+2212 MINUS SIGN, not to ASCII hyphen-minus. This means that a simplistic routine that expects NFKC to convert every exponent into only ASCII digits and punctuation can fail. Exact code-point handling matters.

Unicode does not provide superscript variants of every mathematical operator, Greek letter, radical or multi-line fraction. A character like ½ is a vulgar fraction with its own compatibility decomposition and meaning, not a complete generic fraction-layout format. For an arbitrary rational expression such as (a+b)/(c+d), use MathML or another structured math representation rather than searching for a single Unicode superscript or fraction code point.

Unit notation and scientific quantities must also distinguish mathematical exponents from phonetic or ordinal uses of raised letters. Meaning comes from context. A generic “make all text superscript” transformation does not create a semantically validated scientific formula.

NFKC and the loss of positional distinctions

Under Unicode Standard Annex #15, NFKC applies compatibility mappings that usually convert encoded superscript/subscript numbers and many modifier letters to ordinary letters or digits. NFC normally preserves their encoded positional forms. That difference is important for indexing, copyable decoration and scientific notation.

console.log("\u00B2".normalize("NFC"));  // "²"
console.log("\u00B2".normalize("NFKC")); // "2"
console.log("\u2082".normalize("NFKC")); // "2"
console.log("\u2093".normalize("NFKC")); // "x"
console.log("\u207B".normalize("NFKC")); // "−" (U+2212)
console.log("\u207A".normalize("NFKC")); // "+"

If a platform normalizes x² to NFKC, the stored result may become x2, losing the exponent presentation and potentially changing the intended expression. The same is true for H₂O, which folds to H2O. Compatibility normalization is useful for selected equivalence operations but not a safe universal rewrite for mathematical or chemical display.

When designing search systems, preserve the original displayed string while deriving optional normalized keys for retrieval. A scientific database should not decide that two formulas are semantically identical solely because their NFKC text matches; true formula understanding requires parsing the scientific notation.

Precise digit mapping and controlled fallbacks

Use complete explicit maps for the ten digits, not an inferred contiguous superscript range. A simple converter can retain unsupported letters and punctuation. For a user-facing editor, an explicit indication of unsupported characters is preferable to silently substituting unrelated modifier symbols.

const superDigits = ["⁰","¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹"];
const subDigits   = ["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"];

function convertDigits(input, mode = "super") {
  const alphabet = mode === "super" ? superDigits :
    mode === "sub" ? subDigits : null;
  if (!alphabet) throw new RangeError("Unknown mode");
  return [...input].map(ch => /^[0-9]$/.test(ch)
    ? alphabet[ch.codePointAt(0) - 0x30] : ch).join("");
}

console.log(convertDigits("10-3"));        // "¹⁰-³"
console.log(convertDigits("H2O", "sub"));   // "H₂O"
console.log(convertDigits("x³ + y²"));     // unchanged pre-styled symbols

The function performs only ASCII decimal digit substitution. Its behavior for already superscript digits, other numeral scripts or mathematics operators is explicit: it leaves them alone. If sign conversion is required, define an additional mapping for minus/plus and confirm whether the destination wants U+207B or a true mathematical superscript element in markup. Avoid accidental changes in punctuation or exponent semantics.

A Fancy Text generator can offer these digit variants as copyable symbols, with a visible explanation that there is no universal complete superscript/subscript alphabet in Unicode. A well-designed product can distinguish “Unicode character substitution” from “CSS-raised text” and offer the latter when a rich-text output format is supported.

Semantic superscripts with HTML, CSS and MathML

HTML provides <sup> and <sub> for typographic and semantic annotations such as footnotes, chemical formulas and exponents in ordinary documents. Their text content remains the normal Unicode letters and numbers. For mathematical expressions with grouping, use MathML Core elements such as <msup>, <msub> and <msubsup>, which represent structure beyond simple raised glyphs.

<p>Area: m<sup>2</sup></p>
<p>Water: H<sub>2</sub>O</p>

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <msup><mi>x</mi><mn>2</mn></msup>
</math>

When those examples are copied into a plain-text-only destination, markup-dependent positioning may not survive; that is where encoded Unicode superscript digits have a different practical role. However, choosing encoded characters for a long scientific document solely to retain plain-text appearance can compromise accessibility, editing and search.

CSS vertical-align: super or manual transforms can visually raise characters but do not convey MathML's expression tree or change the underlying code points. Semantics, layout and interchange are separate decisions.

Scientific notation, interoperability and accessibility

Encoded superscripts and subscripts can be convenient for short plain-text expressions, e.g. m², CO₂ or simple reference markers. But technical usage may need specific distinctions, such as indices with several letters, mixed scripts, nested powers and stacked subscripts. A Unicode single-character substitute cannot faithfully represent every such construction.

Screen readers may announce “superscript two,” read it as an ordinary number, or interpret mathematical markup differently depending on context. Rich mathematical markup often provides more structured information to assistive technology than a flat sequence of special characters. Test real screen-reader behavior for the target output rather than assuming a typography-only solution is accessible.

Some fields impose byte limits; the superscript digit ² is a two-byte UTF-8 character versus the one-byte ASCII 2. Unicode modifier letters scattered across different blocks have their own byte lengths and property values. A plain-text generator should document both supported repertoire and target-platform constraints.

For identifiers and security-sensitive data, normalize and validate according to the application or protocol policy. A subscript-styled account name can look distinct while normalizing to ordinary letters. Confusable handling and identifier acceptance require explicit policy, not only display preview.

Reproducible code points and test vectors

CaseExpected
Superscript zeroU+2070
Superscript one/two/threeU+00B9 / U+00B2 / U+00B3
Superscript nineU+2079
Subscript zero–nineU+2080..U+2089
Latin subscript small xU+2093
Superscript minus NFKCU+2212 MINUS SIGN
Subscript two NFKCU+0032 DIGIT TWO
H₂O after NFKCH2O
Unsupported letter in digit-only mapPreserve original character

In a complete test harness, query the UCD Character Name, General_Category and compatibility decomposition for every supported character. Preserve exact code points in expected outputs. Add copies from real messaging apps and text editors to detect platform-specific normalization, filtering and screen-reader incompatibility.

Official Unicode, HTML and math references

  1. Unicode Standard Chapter 22 — Superscripts and Subscripts, intended repertoire and compatibility roles.
  2. Unicode Code Chart U+2070..U+209F — Superscripts and Subscripts.
  3. UAX #15 — Unicode Normalization Forms, canonical versus compatibility mappings.
  4. UAX #44 — Unicode Character Database, names, categories and decompositions.
  5. WHATWG HTML Living Standard — sub and sup elements, text-level semantics.
  6. W3C MathML Core, structured mathematical scripts and layout.

Independent Unicode and mathematical-text research; a Unicode subscript character is not a substitute for structured math in every context.