CSS text-transform Property

The CSS text-transform property controls how text is capitalized or converted to uppercase, lowercase, or other language-specific forms when displayed.

It changes the visual presentation of text without rewriting the original HTML content. The property is commonly used for headings, navigation menus, buttons, labels, and other interface elements. It also provides specialized transformations for certain writing systems.

text-transform Syntax

The text-transform property accepts a keyword that determines how text is transformed when rendered.

Basic Syntax

.example {
  text-transform: uppercase;
}

Available Values

.example {
  text-transform: none;
}
.example {
  text-transform: capitalize;
}
.example {
  text-transform: uppercase;
}
.example {
  text-transform: lowercase;
}
.example {
  text-transform: full-width;
}
.example {
  text-transform: full-size-kana;
}
.example {
  text-transform: math-auto;
}

Combining Specialized Values

The specification allows certain combinations involving full-width and full-size-kana. Support for these combinations varies.

.example {
  text-transform: uppercase full-width;
}
.example {
  text-transform: lowercase full-size-kana;
}
.example {
  text-transform: capitalize full-width full-size-kana;
}

The none and math-auto values cannot be combined with other transformation keywords.

CSS-Wide Keywords

.example {
  text-transform: initial;
}
.example {
  text-transform: inherit;
}
.example {
  text-transform: unset;
}
.example {
  text-transform: revert;
}
.example {
  text-transform: revert-layer;
}

The initial value is none. The property is inherited, so unset behaves like inherit.

Invalid Examples

.example {
  text-transform: bold;
}
.example {
  text-transform: 50%;
}
.example {
  text-transform: 12px;
}
.example {
  text-transform: uppercase lowercase;
}
.example {
  text-transform: none uppercase;
}

Font weights, lengths, percentages, conflicting case transformations, and combinations with none are invalid.

Property Values

Value Description
none Displays text without applying a transformation from this property.
capitalize Transforms the first typographic letter unit of each word to uppercase while leaving other letters unchanged.
uppercase Transforms text to uppercase using language-appropriate case mappings.
lowercase Transforms text to lowercase using language-appropriate case mappings.
full-width Transforms eligible characters into full-width forms used in East Asian typography.
full-size-kana Transforms small kana characters into their corresponding full-size forms.
math-auto Applies automatic mathematical text transformations in supported MathML contexts.

Property Characteristics

Characteristic Value
Initial value none
Inherited Yes
Applies to All elements
Computed value As specified
Animation type Discrete
Percentages Not accepted
Specification CSS Text Module Level 3 and Level 4

Note: The basic case-conversion values have broad browser support. Specialized values such as full-size-kana and math-auto require additional compatibility testing.

How It Works

The browser applies the specified transformation when displaying text. The original characters remain in the HTML source and DOM.

Step 1: Write the HTML

<p class="example-text">Learning CSS Is Fun</p>

Step 2: Apply a Transformation

.example-text {
  text-transform: uppercase;
}

Step 3: View the Result

The browser displays the text as:

Browser Result

Learning CSS Is Fun

Step 4: Change the Value

.example-text {
  text-transform: lowercase;
}

The browser now displays the same source text in lowercase.

Original Content Remains Unchanged

CSS does not rewrite the underlying text. Copying text, reading it through scripts, or submitting it through a form can involve the original characters rather than the transformed appearance.

The none Value

The none value disables transformations performed by this property.

Basic Example

.example {
  text-transform: none;
}

HTML Example

<p class="original-case">Learning CSS Is Fun</p>

CSS Example

.original-case {
  text-transform: none;
}
Browser Result

Learning CSS Is Fun

Overriding an Inherited Transformation

.navigation {
  text-transform: uppercase;
}
.navigation .brand-name {
  text-transform: none;
}

This preserves the original capitalization of a brand name inside uppercase navigation.

When to Use none

Use none when text must retain its original presentation or when overriding a transformation inherited from a parent element.

The capitalize Value

The capitalize value transforms the first letter of each word to uppercase. It does not automatically convert the remaining letters to lowercase.

Basic Example

.example {
  text-transform: capitalize;
}

HTML Example

<p class="capitalize-text">learning css is fun</p>

CSS Example

.capitalize-text {
  text-transform: capitalize;
}
Browser Result

learning css is fun

Existing Capitalization

<p class="capitalize-text">hELLO wORLD</p>

The resulting display is typically HELLO WORLD, not Hello World, because the existing uppercase letters are not converted to lowercase.

Word Boundaries

The browser determines word boundaries using CSS text-processing rules. Results can vary for punctuation, scripts, and language-specific text.

Not a Title-Case Algorithm

The capitalize value does not follow editorial title-capitalization rules. It does not automatically leave articles or prepositions lowercase.

When to Use capitalize

Use this value for simple visual capitalization of labels or headings when precise editorial capitalization is not required.

The uppercase Value

The uppercase value displays letters in uppercase according to applicable language-specific case mappings.

Basic Example

.example {
  text-transform: uppercase;
}

HTML Example

<p class="uppercase-text">Learning CSS Is Fun</p>

CSS Example

.uppercase-text {
  text-transform: uppercase;
}
Browser Result

Learning CSS Is Fun

Navigation Menu Example

.main-navigation a {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

Button Example

.button {
  text-transform: uppercase;
  font-weight: 600;
}

Language-Specific Conversion

Uppercase conversion is not always a simple one-character replacement. Some languages require special mappings that depend on the language of the text.

When to Use uppercase

Use uppercase for short headings, navigation labels, buttons, and other elements where all-capital text suits the design.

Readability Consideration

Long passages of uppercase text can be harder to scan. Avoid applying uppercase transformations to large amounts of body text without a specific reason.

The lowercase Value

The lowercase value displays letters in lowercase using language-appropriate case mappings.

Basic Example

.example {
  text-transform: lowercase;
}

HTML Example

<p class="lowercase-text">Learning CSS Is Fun</p>

CSS Example

.lowercase-text {
  text-transform: lowercase;
}
Browser Result

Learning CSS Is Fun

Lowercase Labels

.category-label {
  text-transform: lowercase;
}

Lowercase Headings

.section-heading {
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

Language-Specific Conversion

Some languages have lowercase mappings that depend on context or language. Correct language identification helps browsers apply the appropriate rules.

When to Use lowercase

Use this value when a lowercase visual style is desired without modifying the source text.

Important Consideration

Lowercase transformations can change the appearance of acronyms, proper names, and technical terms. Exclude text that must preserve its original capitalization.

The full-width Value

The full-width value transforms eligible characters into full-width forms commonly used in East Asian typography.

Basic Example

.example {
  text-transform: full-width;
}

HTML Example

<p class="full-width-text">ABC 123</p>

CSS Example

.full-width-text {
  text-transform: full-width;
}
Browser Result

ABC 123

Full-Width Character Forms

Where supported, ordinary Latin letters and digits can be displayed using full-width equivalents, such as ABC 123.

East Asian Typography

Full-width characters can align more naturally with CJK text, where many characters occupy square character cells.

Combining With Uppercase

.example {
  text-transform: uppercase full-width;
}

This requests uppercase conversion together with full-width character forms.

When to Use full-width

Use this value for specialized East Asian typography where full-width Latin characters or digits are appropriate.

Important Consideration

The transformation does not rewrite the original characters in the HTML. Browser support and font rendering can affect the result.

The full-size-kana Value

The full-size-kana value transforms small Japanese kana characters into their corresponding full-size forms.

Basic Example

.example {
  text-transform: full-size-kana;
}

HTML Example

<p lang="ja" class="kana-text">ぁぃぅぇぉ</p>

CSS Example

.kana-text {
  text-transform: full-size-kana;
}
Browser Result

ぁぃぅぇぉ

Kana Transformation

Where supported, small kana characters such as ぁ and ぃ are displayed using their full-size counterparts, such as あ and い.

Specialized Japanese Typography

The value is intended for particular typographic situations and should not be applied indiscriminately to ordinary Japanese text.

Meaning and Pronunciation

Small kana can affect pronunciation and meaning. Changing their appearance may misrepresent the intended text.

When to Use full-size-kana

Use this value only when the typography specifically calls for full-size kana forms and the transformation is appropriate for the content.

Browser Support

Support for full-size-kana is limited. Test the value in the target browsers before relying on it.

The math-auto Value

The math-auto value provides automatic mathematical text transformations in supported MathML contexts.

Basic Syntax

math mi {
  text-transform: math-auto;
}

MathML Example

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mi>x</mi>
  <mo>+</mo>
  <mi>y</mi>
</math>

CSS Example

math mi {
  text-transform: math-auto;
}

Mathematical Presentation

The transformation can help browsers render mathematical identifiers according to mathematical typography rules.

Not a General Text Transformation

The value is intended for mathematical content, not ordinary headings, paragraphs, or navigation labels.

Browser Support

Support for math-auto varies. The exact result depends on the browser's MathML implementation.

Important Consideration

Use semantic MathML markup for mathematical expressions rather than attempting to reproduce mathematical meaning with CSS alone.

Language-Specific Rules

Text transformations can depend on the language of the content. The browser uses language information to select appropriate case mappings where supported.

Turkish and Azerbaijani

These languages have special uppercase and lowercase mappings for dotted and dotless forms of the letter I.

<p lang="tr" class="uppercase-text">istanbul</p>

With text-transform: uppercase, the appropriate Turkish uppercase form begins with İ.

Greek

Greek text has case-mapping rules that may depend on the position of a letter within a word and other linguistic context.

<p lang="el" class="lowercase-text">ΟΣ</p>

German

Uppercase conversion of the German letter ß can involve a multi-character mapping such as SS, depending on the applicable rules and implementation.

<p lang="de" class="uppercase-text">straße</p>

Dutch

Dutch capitalization includes special handling for the ij combination in certain contexts.

<p lang="nl" class="capitalize-text">ijsselmeer</p>

Use the lang Attribute

<p lang="en">English text</p>
<p lang="tr">Türkçe metin</p>
<p lang="de">Deutscher Text</p>
<p lang="el">Ελληνικό κείμενο</p>

Important Consideration

Do not assume that uppercase and lowercase transformations produce identical results across all languages. Set the correct language on the document or relevant elements.

Inheritance

The text-transform property is inherited. Descendant elements use the parent's computed value unless they specify their own.

Parent Element Example

.navigation {
  text-transform: uppercase;
}

Text inside the navigation inherits the uppercase transformation.

Override on a Child Element

.navigation {
  text-transform: uppercase;
}
.navigation .brand {
  text-transform: none;
}

Explicit Inheritance

.child {
  text-transform: inherit;
}

Restore the Initial Value

.child {
  text-transform: initial;
}

This restores none.

Using unset

.child {
  text-transform: unset;
}

Because the property is inherited, unset uses the parent's computed value.

Nested Text Example

<div class="uppercase-container">
  <p>This paragraph is uppercase.</p>
  <p class="original-text">This paragraph keeps its original case.</p>
</div>
.uppercase-container {
  text-transform: uppercase;
}
.uppercase-container .original-text {
  text-transform: none;
}

Important Consideration

Applying text-transform to a parent can affect more content than intended. Use targeted selectors when only specific labels or headings should be transformed.

Several CSS properties can be combined with text-transform to control typography.

font-variant-caps

.example {
  font-variant-caps: small-caps;
}

Controls the use of capital-letter variants, including small capitals, when supported by the font.

font-weight

.example {
  font-weight: 600;
}

Controls the weight of the text.

letter-spacing

.example {
  letter-spacing: 0.05em;
}

Adjusts spacing between typographic characters.

font-size

.example {
  font-size: 1.25rem;
}

Controls the size of the text.

text-decoration

.example {
  text-decoration: underline;
}

Adds decorative lines to text.

Comparison

Property Purpose
text-transform Controls capitalization and other text transformations.
font-variant-caps Controls capital-letter variants.
font-weight Controls text weight.
letter-spacing Controls character spacing.
font-size Controls text size.
text-decoration Controls decorative text lines.

Practical Examples

Uppercase Navigation Links

.main-navigation a {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

Capitalized Section Labels

.section-label {
  text-transform: capitalize;
}

Lowercase Category Labels

.category-label {
  text-transform: lowercase;
}

Uppercase Buttons

.button {
  text-transform: uppercase;
  font-weight: 600;
}

Preserve Brand Capitalization

.navigation {
  text-transform: uppercase;
}
.navigation .brand-name {
  text-transform: none;
}

Small Caps Instead of Uppercase

.small-caps-label {
  font-variant-caps: small-caps;
}

Full-Width Characters

.cjk-label {
  text-transform: full-width;
}

Japanese Kana Transformation

.japanese-kana {
  text-transform: full-size-kana;
}

Responsive Heading

.page-heading {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

Override Inherited Uppercase

.sidebar {
  text-transform: uppercase;
}
.sidebar .description {
  text-transform: none;
}

Language-Specific Uppercase

<p lang="tr" class="uppercase-text">istanbul</p>
.uppercase-text {
  text-transform: uppercase;
}

text-transform Example

This example compares the four most commonly used values. Each sample contains the same original text, but CSS changes how it appears.

HTML Example

<div class="text-transform-demo">
  <div class="transform-sample">
    <strong>none</strong>
    <p class="transform-none">Learning CSS Is Fun</p>
  </div>
  <div class="transform-sample">
    <strong>capitalize</strong>
    <p class="transform-capitalize">Learning CSS Is Fun</p>
  </div>
  <div class="transform-sample">
    <strong>uppercase</strong>
    <p class="transform-uppercase">Learning CSS Is Fun</p>
  </div>
  <div class="transform-sample">
    <strong>lowercase</strong>
    <p class="transform-lowercase">Learning CSS Is Fun</p>
  </div>
</div>

CSS Example

.text-transform-demo {
  display: grid;
  gap: 12px;
}
.text-transform-demo .transform-sample {
  padding: 14px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}
.text-transform-demo strong {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 14px;
}
.text-transform-demo p {
  margin: 0;
  color: #1f2937;
  font-size: 20px;
  line-height: 1.5;
}
.text-transform-demo .transform-none {
  text-transform: none;
}
.text-transform-demo .transform-capitalize {
  text-transform: capitalize;
}
.text-transform-demo .transform-uppercase {
  text-transform: uppercase;
}
.text-transform-demo .transform-lowercase {
  text-transform: lowercase;
}
Browser Result
none

Learning CSS Is Fun

capitalize

Learning CSS Is Fun

uppercase

Learning CSS Is Fun

lowercase

Learning CSS Is Fun

Understanding the Results

The none value preserves the original appearance. The capitalize value capitalizes the first letter of each word, while uppercase and lowercase transform all applicable letters.

Testing Mixed Capitalization

<p class="transform-capitalize">hELLO wORLD</p>

With capitalize, existing uppercase letters remain uppercase. The property does not automatically create conventional title case.

Testing Other Languages

Try the same declarations with correctly identified Turkish, Greek, or German text to examine language-specific transformations.

Accessibility Considerations

Text transformations affect visual presentation, but they can also influence readability and how text is interpreted by assistive technologies.

Preserve Meaningful Capitalization

Proper names, abbreviations, and technical terms may require specific capitalization. Avoid transformations that make their meaning less clear.

Avoid Long Uppercase Passages

All-uppercase text can be harder to scan, particularly in long paragraphs.

Identify the Language

Use the lang attribute so browsers and assistive technologies can apply appropriate language rules.

Do Not Rely on CSS for Content Corrections

If text must have a particular capitalization for accuracy, write it correctly in the HTML rather than depending on CSS.

Consider Screen Readers

Screen readers may use the underlying text or exposed rendered text depending on the browser and accessibility environment. Do not depend on a CSS transformation to control pronunciation.

Maintain Readable Letter Spacing

Uppercase labels may benefit from modest letter spacing, but excessive spacing can reduce readability.

Preserve Acronyms

Acronyms such as HTML, CSS, and API should remain recognizable. Avoid applying lowercase transformations when their original form matters.

Use Appropriate Font Sizes

Text transformations do not replace readable font sizes, sufficient contrast, or suitable line spacing.

Test Multilingual Content

Check transformations with the actual languages and scripts used on the website.

Common Mistakes

Expecting capitalize to Produce Title Case

The capitalize value uppercases the first letter of each word but does not apply editorial title-case rules.

Expecting capitalize to Lowercase Other Letters

<p class="capitalize-text">hELLO wORLD</p>

Existing uppercase letters remain uppercase.

Assuming the HTML Content Changes

CSS transformations change the rendered presentation, not the original HTML text.

Using Invalid Values

.example {
  text-transform: titlecase;
}

The titlecase keyword is not a valid value.

Combining Conflicting Case Values

.example {
  text-transform: uppercase lowercase;
}

Only one of capitalize, uppercase, and lowercase can be used in a declaration.

Confusing uppercase With Small Caps

Use font-variant-caps for small-capital typography rather than assuming uppercase produces small capitals.

Applying Uppercase to Long Paragraphs

Long uppercase passages can reduce readability.

Ignoring Language-Specific Rules

Case mappings vary across languages. Use the correct lang attribute.

Transforming Brand Names

Some brand names rely on specific capitalization. Override inherited transformations when necessary.

Assuming Specialized Values Have Universal Support

The full-size-kana and math-auto values are not consistently supported.

Using full-size-kana Without Considering Meaning

Small kana characters can affect pronunciation and meaning. Their transformation should be intentional.

Using CSS for Data Normalization

The property does not normalize stored values or form submissions. Use appropriate application logic when data must be converted.

Forgetting Inheritance

A transformation applied to a parent can affect all descendant text unless overridden.

Important Considerations

Keep the following points in mind when using text-transform:

  • The property controls the displayed form of text.
  • The initial value is none.
  • The property is inherited.
  • Basic values include none, capitalize, uppercase, and lowercase.
  • Specialized values include full-width, full-size-kana, and math-auto.
  • Some specialized values can be combined with case transformations.
  • The capitalize value does not automatically lowercase the remaining letters of each word.
  • The capitalize value is not a complete editorial title-case solution.
  • Uppercase and lowercase mappings can depend on language.
  • The lang attribute helps identify the correct language.
  • The property does not rewrite the original HTML content.
  • It does not directly normalize stored data or form values.
  • It does not control font weight or font size.
  • It does not create small capitals.
  • The full-width value is intended for specialized East Asian typography.
  • The full-size-kana value can affect the presentation of Japanese kana.
  • The math-auto value is intended for mathematical content.
  • Browser support for specialized values varies.
  • Inherited transformations can affect nested elements.
  • Long uppercase passages can reduce readability.
  • Preserve meaningful capitalization for names, acronyms, and technical terms.
  • Test multilingual transformations in the target browsers.

Browser Support

The CSS text-transform property is widely available in modern browsers for the commonly used values none, capitalize, uppercase, and lowercase.

Support for specialized values, including full-width, full-size-kana, and math-auto, varies by browser and implementation.

For current compatibility information, visit Can I Use? and search for text-transform.

Basic Declaration

.example {
  text-transform: uppercase;
}

Feature Detection

@supports (text-transform: full-width) {
  .cjk-label {
    text-transform: full-width;
  }
}

Checking Specialized Values

@supports (text-transform: full-size-kana) {
  .japanese-kana {
    text-transform: full-size-kana;
  }
}

Feature queries can check whether the browser recognizes a declaration, but they do not guarantee identical language-specific rendering.

Fallback Behavior

Browsers that do not recognize a particular value ignore the invalid declaration. The previously applicable value remains in effect.

Testing Recommendations

Test specialized transformations with the actual languages, fonts, and browsers used by the website.

Specifications

The text-transform property is defined in the CSS Text Module specifications.

CSS Text Module Level 3 - text-transform Property

CSS Text Module Level 4 - text-transform Property

The specifications describe the available values, case-conversion rules, language-sensitive transformations, and specialized typographic behavior.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: text-transform