Java Character toUpperCase() Method

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

Definition

In Java, Character.toUpperCase(ch) returns the uppercase form of a character: 'a' becomes 'A', Greek small alpha becomes capital alpha. Characters without an uppercase form, such as digits and punctuation, come back unchanged.

It maps exactly one character to one character and never consults the locale. That is why German sharp s (U+00DF), whose uppercase is the two letters "SS", is returned unchanged; String.toUpperCase is the method that can expand it.

A static method of java.lang.Character (Java 1.0+): call it on the class, as in Character.toUpperCase(...); 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

Pass a char to get a char, or an int code point to get an int.

Java
char a = Character.toUpperCase('a');        // 'A'
char b = Character.toUpperCase('A');        // 'A'
char c = Character.toUpperCase('\u00DF');   // '\u00DF', sharp s has no one-char uppercase
int d = Character.toUpperCase(0x03B1);      // 0x0391 (913)
CallWhat it does
Character.toUpperCase(s.charAt(0)) + s.substring(1)Capitalise the first letter of a word.
Character.toUpperCase(c)Uppercase one character.
Character.toUpperCase(cp)Uppercase a code point (returns int).

Overloads: char toUpperCase(char ch) and int toUpperCase(int codePoint). For capitalising the first letter of a word, toTitleCase() is the fully correct choice; for ordinary letters it gives the same result.

Library declarations
Java
// java.lang.Character
public static char toUpperCase(char ch)
public static int toUpperCase(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 uppercase equivalent, or the argument itself if it has none.

Compare with Similar Methods

Related conversions:

MethodHow it differs
String.toUpperCase(Locale)Whole-string, locale-aware, can turn one character into two.
toTitleCase(ch)The form for the first letter of a word; differs only for a few digraphs.
toLowerCase(ch)The lowercase direction.

Java Examples

Example 1 — Capitalise the First Letter of Every Word

Uppercase each letter that follows a space, plus the very first one.

Java
public class CharacterToUpperCaseWords {
    public static void main(String[] args) {
        String text = "the quick brown fox";
        StringBuilder out = new StringBuilder();
        boolean startOfWord = true;
        for (char c : text.toCharArray()) {
            out.append(startOfWord ? Character.toUpperCase(c) : c);
            startOfWord = (c == ' ');
        }
        System.out.println(out);
    }
}

How It Works

  1. A start-of-word flag. startOfWord is true for the first character and for every character right after a space.
  2. Convert only word starts. The conditional expression picks the uppercase form for t, q, b, and f and leaves the other letters alone.
  3. Both branches are chars. Character.toUpperCase(c) and c are both char, so append adds a letter; with an int branch, it would append a number.

Example 2 — Why Sharp s Stays Lowercase in Character.toUpperCase

Compare the single-character conversion with String.toUpperCase(Locale.ROOT) on the German word "Strasse" spelled with sharp s.

Java
import java.util.Locale;

public class CharacterToUpperCaseSharpS {
    public static void main(String[] args) {
        char sharp = '\u00DF';
        char upper = Character.toUpperCase(sharp);
        System.out.println("Character.toUpperCase: " + (int) upper + " (unchanged: " + (upper == sharp) + ")");

        String word = "Stra\u00DFe";
        String up = word.toUpperCase(Locale.ROOT);
        System.out.println("String.toUpperCase: " + up + " (length " + word.length() + " -> " + up.length() + ")");
    }
}

How It Works

  1. No one-character answer. The uppercase of sharp s is two letters, and a char can hold only one, so Character.toUpperCase returns 223 (U+00DF) itself.
  2. String can grow. String.toUpperCase applies the full Unicode mapping, turning sharp s into "SS" and the 6-character word into 7 characters.
  3. Locale.ROOT for stable results. Passing Locale.ROOT keeps the string conversion independent of the computer's language settings.

Example 3 — Turkish i: Character Ignores the Locale

In Turkish, the capital of i is a dotted capital I. Compare the char method with locale-aware String conversions.

Java
import java.util.Locale;

public class CharacterToUpperCaseLocale {
    public static void main(String[] args) {
        Locale turkish = Locale.forLanguageTag("tr");
        System.out.println("Character.toUpperCase('i'): " + (int) Character.toUpperCase('i'));
        System.out.println("String, ROOT locale: " + (int) "i".toUpperCase(Locale.ROOT).charAt(0));
        System.out.println("String, Turkish locale: " + (int) "i".toUpperCase(turkish).charAt(0));
    }
}

How It Works

  1. A Turkish locale object. Locale.forLanguageTag("tr") (Java 7+) builds the locale without the constructor that newer JDKs deprecate.
  2. Always the same answer. Character.toUpperCase('i') returns 'I' (73) on every machine, because it ignores locales entirely.
  3. Language rules in String. With the Turkish locale, String.toUpperCase returns U+0130 (304), LATIN CAPITAL LETTER I WITH DOT ABOVE; printing its code keeps the console output ASCII.

Frequently Asked Questions

Character.toUpperCase(s.charAt(0)) + s.substring(1), after checking that s is not empty. Use codePointAt and toChars if the first character may be above U+FFFF.
Its uppercase is the two letters SS, and the method can only return one character. String.toUpperCase can return SS.
No. It always uses the Unicode simple mapping. Use String.toUpperCase(Locale) for language-specific rules such as Turkish.
They differ only for a few digraph letters such as U+01C6: toUpperCase gives the all-capital form U+01C4, toTitleCase gives U+01C5.
No. Characters without case are returned unchanged.

Next: valueOf()

Wrap a char in a Character object, reusing cached objects for ASCII.

valueOf() 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.

12 people found this page helpful