C# String ToLowerInvariant() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
String

Definition

In C#, ToLowerInvariant() returns a lowercase copy of a string using the invariant culture. The invariant culture is a fixed set of rules that does not belong to any country, so the result is the same on every computer, whatever its language settings.

Use it for text that a program reads: file extensions, command names, dictionary keys, tags, and protocol words. For text shown to a person in their own language, ToLower() with the current culture can be the better choice.

This is an instance member of System.String. Call it on a string variable, such as text.ToLowerInvariant(...). Calling it on a null variable throws NullReferenceException. C# strings are immutable: ToLowerInvariant() never changes the original text. It gives back a new string (or the same one when there is nothing to change), so keep the result in a variable.

Syntax

No arguments. It is the short form of ToLower(CultureInfo.InvariantCulture).

C#
string code = "Hello WORLD 123";
string key = code.ToLowerInvariant();   // "hello world 123"
CallWhat it does
text.ToLowerInvariant()Lowercase with fixed rules.
switch (cmd.ToLowerInvariant())Match commands typed in any case.
key.ToLowerInvariant()Normalize keys before storing them.

It takes no parameters and never depends on CultureInfo.CurrentCulture. It is still a full Unicode lowercase, not only A to Z: letters like É become é. If you only need a comparison, StringComparison.OrdinalIgnoreCase avoids creating a new string at all.

Library declarations
C#
public string ToLowerInvariant();

Parameters

ParameterDescription
NoneToLowerInvariant() takes no parameters.

Return Value

Return ValueDescription
stringA new lowercase copy using invariant casing rules.

C# Examples

Example 1 — A Machine-Independent Lowercase

Lowercase a mixed string with letters, spaces, and digits.

C#
using System;

class Program {
    static void Main() {
        string code = "Hello WORLD 123";
        string lower = code.ToLowerInvariant();

        Console.WriteLine(lower);
        Console.WriteLine(lower.Length == code.Length);
    }
}

How It Works

  1. All letters lowered. Both the single capital H and the all-caps WORLD become lowercase.
  2. No culture involved. The call does not look at the computer's language settings, so this exact output appears everywhere.
  3. Same length here. For these characters, each letter maps to exactly one letter, so the lengths match.
  4. Digits are ignored. 123 has no case and is copied unchanged.

Example 2 — Accept Commands in Any Case

Lowercase each command once, then match it in a switch.

C#
using System;

class Program {
    static void Main() {
        string[] inputs = { "STOP", "Status", "jump" };

        foreach (string input in inputs) {
            switch (input.ToLowerInvariant()) {
                case "stop":
                    Console.WriteLine("Stopping");
                    break;
                case "status":
                    Console.WriteLine("Showing status");
                    break;
                default:
                    Console.WriteLine("Unknown command: " + input);
                    break;
            }
        }
    }
}

How It Works

  1. One spelling in the switch. Each case label is written in lowercase only once.
  2. Lower the input, not the cases. STOP and Status both turn into words that match a label.
  3. Unknown stays unknown. jump matches no label, so the default branch prints it with its original spelling.
  4. Fixed rules matter here. A command list like this must behave identically for every user, which is exactly what the invariant culture guarantees.

Example 3 — ToLowerInvariant and ToLower(InvariantCulture) Are Twins

Show that both spellings give the same text, while the original stays in capitals.

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        string title = "TITLE";

        string a = title.ToLowerInvariant();
        string b = title.ToLower(CultureInfo.InvariantCulture);

        Console.WriteLine(a);
        Console.WriteLine(a == b);
        Console.WriteLine(title);
    }
}

How It Works

  1. A risky word. TITLE contains a capital I, the letter that the Turkish culture lowercases to a dotless ı.
  2. Invariant gives i. With fixed rules, the result is always title, on every computer.
  3. Two spellings, one result. ToLower(CultureInfo.InvariantCulture) produces the same text, so the comparison prints True.
  4. Capitals kept. title was never changed; both calls returned new strings.

Frequently Asked Questions

It returns a lowercase copy of the string using the invariant culture, so the result is the same on every computer.
Use ToLowerInvariant for text that code reads or compares: keys, file extensions, commands, and tags. Use ToLower with a culture for text that people read in their language.
Yes. They produce the same result. ToLowerInvariant is simply shorter and needs no System.Globalization import.
No. The closest options are ToLowerInvariant for making a lowercase copy and StringComparison.OrdinalIgnoreCase for comparing without case.
No. It returns a new string and the original stays as it was.

Next: ToLowerOrdinal()

There is no built-in ToLowerOrdinal(); see what to use instead for culture-safe lowercase and comparisons.

ToLowerOrdinal() 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