Java Character toTitleCase() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
java.lang.Character

Definition

In Java, Character.toTitleCase(ch) returns the character's titlecase form: the shape it should have as the first letter of a capitalised word. For ordinary letters that is just the uppercase letter, so toTitleCase('a') is 'A'.

The difference shows up for a handful of digraph characters. The lowercase digraph U+01C6 has the uppercase form U+01C4 (both parts capital) and the titlecase form U+01C5 (only the first part capital). If Unicode lists no titlecase mapping, the uppercase mapping is used.

A static method of java.lang.Character (Java 1.0+): call it on the class, as in Character.toTitleCase(...); you do not need a Character object. No import is needed, because java.lang is always available. The int codePoint overload was added in Java 5.

Unicode version.

The answer comes from the Unicode Character Database built into your JDK, and each Java release follows a specific Unicode version (Java 8, for example, uses Unicode 6.2). The characters used on this page have had the same properties for many Unicode versions, so the examples print the same result on any current JDK.

Syntax

Same shape as the other case conversions: char in, char out, or int in, int out.

Java
char a = Character.toTitleCase('a');        // 'A', same as toUpperCase
char b = Character.toTitleCase('\u01C6');   // '\u01C5', capital D + small z with caron
char c = Character.toUpperCase('\u01C6');   // '\u01C4', both parts capital
char d = Character.toTitleCase('9');        // '9', no case
CallWhat it does
Character.toTitleCase(word.charAt(0))Capitalise the first character of a word.
Character.toTitleCase(cp)The code point version.
Character.isTitleCase(Character.toTitleCase(c))True only when a special titlecase letter exists.

Overloads: char toTitleCase(char ch) and int toTitleCase(int codePoint). There is no String.toTitleCase() in the JDK; you combine this method with toLowerCase yourself.

Library declarations
Java
// java.lang.Character
public static char toTitleCase(char ch)
public static int toTitleCase(int codePoint)   // since Java 5

Parameters

ParameterDescription
ch (char)The character to convert.
codePoint (int)The code point to convert.

Return Value

Return ValueDescription
char / intThe titlecase form; the uppercase form when no titlecase mapping exists; the argument itself when it has no case.

Compare with Similar Methods

The three case conversions:

MethodHow it differs
toUpperCase(ch)All-capital form; differs only for digraphs.
toLowerCase(ch)The lowercase form.
isTitleCase(ch)Tests for the titlecase category.

Java Examples

Example 1 — Turn "hELLO wORLD" into "Hello World"

Titlecase the first letter of each word and lowercase the rest.

Java
public class CharacterToTitleCasePhrase {
    public static void main(String[] args) {
        String phrase = "hELLO wORLD";
        StringBuilder out = new StringBuilder();
        boolean first = true;
        for (char c : phrase.toCharArray()) {
            if (c == ' ') {
                out.append(c);
                first = true;
            } else {
                out.append(first ? Character.toTitleCase(c) : Character.toLowerCase(c));
                first = false;
            }
        }
        System.out.println(out);
    }
}

How It Works

  1. Two conversions per word. The first letter goes through toTitleCase; every later letter goes through toLowerCase.
  2. Spaces reset the state. A space is copied and sets first back to true, so w becomes W.
  3. Same as uppercase here. For h and w, titlecase and uppercase are identical; the method only matters for digraphs, but it is the semantically right call for "first letter of a word".

Example 2 — Every Form of the Digraph Maps to U+01C5

Apply toTitleCase and toUpperCase to the uppercase, titlecase, and lowercase forms of one digraph.

Java
public class CharacterToTitleCaseDigraph {
    public static void main(String[] args) {
        char[] forms = {'\u01C4', '\u01C5', '\u01C6'};
        for (char c : forms) {
            System.out.println((int) c + " title=" + (int) Character.toTitleCase(c)
                    + " upper=" + (int) Character.toUpperCase(c));
        }
    }
}

How It Works

  1. One titlecase target. Whatever form you start from, toTitleCase lands on U+01C5 (453).
  2. One uppercase target. toUpperCase always lands on U+01C4 (452), even from the titlecase form.
  3. Casting for printing. Both methods return char; the (int) casts print code numbers so the console never has to draw the digraphs.

Example 3 — toTitleCase on Code Points, Digits, and Sharp s

Use the int overload on a Deseret letter above U+FFFF, a plain letter, a digit, and sharp s.

Java
public class CharacterToTitleCaseCodePoints {
    public static void main(String[] args) {
        int[] cps = {0x10428, 'z', '5', 0x00DF};
        for (int cp : cps) {
            int title = Character.toTitleCase(cp);
            System.out.println(Integer.toHexString(cp) + " -> " + Integer.toHexString(title)
                    + (title == cp ? " (unchanged)" : ""));
        }
    }
}

How It Works

  1. Supplementary letters work. DESERET SMALL LETTER LONG I (0x10428) has no separate titlecase mapping, so its uppercase U+10400 is returned.
  2. Hex output. Integer.toHexString prints 'z' as 7a and its titlecase 'Z' as 5a.
  3. No single-character answer. The digit has no case, and sharp s has no one-character titlecase form, so both come back unchanged.

Frequently Asked Questions

For almost every character they return the same result. They differ for digraphs such as U+01C6, where titlecase capitalises only the first part.
No. Loop over the words yourself: apply Character.toTitleCase to the first character and Character.toLowerCase to the rest.
toTitleCase('a') returns 'A', which belongs to the UPPERCASE_LETTER category. Only digraph-style characters are TITLECASE_LETTER.
No. It uses Unicode data only and ignores the default locale.
It is the most correct single-character choice for the first letter. For names you may also need locale rules and exceptions such as McDonald, which no single method handles.

Next: toUpperCase()

Convert one character to uppercase, using Unicode rules.

toUpperCase() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful