C# Char ToUpperInvariant() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Char

Definition

In C#, Char.ToUpperInvariant returns the uppercase form using the invariant culture.

Use it for culture-neutral normalization—keys, protocols, and comparisons that must not follow the user locale.

This is a static member of System.Char. You call it with the type name, such as Char.ToUpperInvariant(...) or char.ToUpperInvariant(...). A char holds one 16-bit UTF-16 code unit.

Syntax

Pass the character to uppercase invariantly.

C#
char up = Char.ToUpperInvariant('a');
CallWhat it does
Char.ToUpperInvariant(c)Uppercase with invariant culture.

Does not use the current UI culture.

Library declarations
C#
public static char ToUpperInvariant(char c);

Parameters

ParameterDescription
cCharacter to convert.

Return Value

Return ValueDescription
charInvariant uppercase character.

C# Examples

Example 1 — a Becomes A

Uppercase with invariant rules.

C#
using System;

class Program {
    static void Main() {
        Console.WriteLine(Char.ToUpperInvariant('a'));
        Console.WriteLine(Char.ToUpperInvariant('z'));
    }
}

How It Works

  1. a → A. Latin mapping.
  2. z → Z. End of alphabet.
  3. Invariant. Locale-independent.
  4. Key friendly. Stable for identifiers.

Example 2 — Upper a Label

Normalize each letter to upper.

C#
using System;

class Program {
    static void Main() {
        string label = "ok";
        string up = "";
        foreach (char ch in label) {
            up += Char.ToUpperInvariant(ch);
        }
        Console.WriteLine(up);
    }
}

How It Works

  1. Short label. ok.
  2. Per-char upper. Invariant mapping.
  3. OK result. Normalized.
  4. String helper. label.ToUpperInvariant() also works.

Example 3 — Letters Change, Digits Stay

Uppercase letters inside mixed content.

C#
using System;

class Program {
    static void Main() {
        string raw = "a1b";
        string outText = "";
        foreach (char ch in raw) {
            outText += Char.ToUpperInvariant(ch);
        }
        Console.WriteLine(outText);
    }
}

How It Works

  1. Mixed input. Letters and a digit.
  2. Letters rise. a and b become A and B.
  3. Digit stays. 1 unchanged.
  4. A1B result. Predictable normalization.

Frequently Asked Questions

ToUpper uses culture; this uses invariant culture.
ToUpperOrdinal in .NET 7+.
Yes.
Typically no change.
Yes.

Next: ToUpperOrdinal()

Convert a character to uppercase using ordinal mapping. .NET 7+ with System.Char.

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

10 people found this page helpful