C# Capitalize First Letter (Single Char or Every Word)
/ 5 min read
Updated:Found this post helpful?
Buy me a coffeeTable of Contents
Presentation is an essential part of the language, let alone a software application. How we utilize script can make the difference between an enjoyable user experience or an incomprehensible mess. As developers, we likely spend more time formatting strings than we’d like to admit. I hope to save you some time as it relates to strings. In this post, we’ll see how we can capitalize the first letter of a string, and also convert any string to a language-native title casing, all with classes already found within the .NET Framework.
Updated: October 2026 — added a direct answer for capitalizing just the first letter of a string, since that’s what most readers searching for “C# capitalize first letter” actually need.
How Do You Capitalize the First Letter of a String in C#?
Uppercase the first character with char.ToUpper and concatenate it with the rest of the string using range syntax. Here’s a small, reusable method:
string Capitalize(string input) => string.IsNullOrEmpty(input) ? input : char.ToUpper(input[0]) + input[1..];
Capitalize("hello world"); // "Hello world"The input[1..] range syntax requires a modern C# version (works great on .NET 8), but you can swap it for input.Substring(1) if you’re on an older runtime. This approach only touches the first character of the whole string, leaving the rest of it untouched.
If you instead want every word in a string capitalized — true title casing — keep reading. TextInfo.ToTitleCase is built for that, and it’s covered below.
What Is TextInfo?
Most display elements and translation are not universal regarding .NET but instead driven by culture-specific instances of CultureInfo. The CultureInfo instances define styles of dates, currency, and more. Nested within each CultureInfo is the TextInfo class that defines the specific behaviors attributed to a culture’s writing system. As the comment on the TextInfo class states:
A writing system is the collection of scripts and orthographic rules required to represent a language as text. – .NET Framework
How Do You Capitalize the First Letter of Every Word in C#?
Use CultureInfo’s TextInfo.ToTitleCase method, which capitalizes the first letter of each word in a string according to a culture’s rules. Title casing pertains to the style of titles for books, posts, and essays. In other words, the practice of title casing is the capitalization of each word’s first letter in a string. For example, the string literal “khalid abuhakmeh is the best” would be title-cased to “Khalid Abuhakmeh Is The Best”.
The act of title-casing might seem straightforward to many, but each culture should apply its own rules to accurately title-case a target string. Each culture provides local conventions that .NET needs to account for when converting values. Looking at the comments left on the TextInfo type, we can see some clear examples.
For English readers, the title “The Merry Wives of Windsor” is the appropriate title casing for the value, with the word “of” not being uppercased. For German readers, the translated title would be “Die lustigen Weiber von Windsor,” and both “lustigen” and “von” would not be uppercased. For folks who read Dutch, they will know that .NET must capitalize on the letters “IJ” at the beginning of each word when present. Who knew that capitalizing words could be so tricky?
Using CultureInfo.TextInfo
While title casing can have specifics, from my testing, I’ve found that other than the unique edge cases around Dutch, that .NET capitalizes the first letter of each disparate word. In the case of “the merry wives of windsor”, we get “The Merry Wives Of Windsor”. Note the capitalization of each letter. The capitalized letters are an acceptable outcome. Let’s take a look at the code that generated this outcome.
using static System.Console;using static System.Globalization.CultureInfo;
var cultureCode = "en-gb";
CurrentUICulture =CurrentCulture = GetCultureInfo(cultureCode);
var info = CurrentCulture.TextInfo;var name = "the merry wives of windsor";
WriteLine(info.CultureName);WriteLine(info.ToTitleCase(name));In the example above, we set the CurrentCulture and the CurrentUICulture to the British English variant (en-GB). If we look at the constructor of TextInfo, we’ll see it accepts a CultureData parameter, presumably to understand title casing rules.
internal TextInfo(CultureData cultureData){ // This is our primary data source, we don't need most of the rest of this _cultureData = cultureData; _cultureName = _cultureData.CultureName; _textInfoName = _cultureData.TextInfoName;
if (GlobalizationMode.UseNls) { _sortHandle = CompareInfo.NlsGetSortHandle(_textInfoName); }}We can also look at the CultureInfo class to see how it creates the TextInfo instance.
public virtual TextInfo TextInfo{ get { if (_textInfo == null) { // Make a new textInfo TextInfo tempTextInfo = new TextInfo(_cultureData); tempTextInfo.SetReadOnlyState(_isReadOnly); _textInfo = tempTextInfo; } return _textInfo; }}Why Doesn’t ToTitleCase Work on ALL-CAPS Strings?
ToTitleCase leaves fully uppercase words unchanged because it assumes an ALL-CAPS word is an acronym rather than a word that needs casing applied. For example, info.ToTitleCase("HELLO WORLD") returns "HELLO WORLD" — not "Hello World" — because .NET treats “HELLO” and “WORLD” as acronyms it shouldn’t touch.
If you want every word capitalized regardless of its original casing, lowercase the string first, then title-case it:
var name = "HELLO WORLD";WriteLine(info.ToTitleCase(name.ToLower())); // "Hello World"This sidesteps the acronym detection entirely by ensuring ToTitleCase never sees an all-uppercase word to begin with.
Conclusion
Strangely, the XML documentation for ToTitleCase makes a big deal around culture-specific capitalization rules. For English, the lowercasing of of was pointed out explicitly in the documentation, but it was also upper-cased in practice. While the CultureInfo instance passes CultureData to the newly created TextInfo, it doesn’t seem to have much of an effect on title casing. That said, the upper-casing of articles, adjectives, and conjunctions is not likely to deter me from using ToTitleCase. I highly recommend this approach for anyone looking to uppercase the first letter of every word within a string. And if all you need is the very first letter of a string capitalized, the simple char.ToUpper method at the top of this post will do the job without reaching for culture-specific title casing. (Note that char.ToUpper still uses the current culture; pass CultureInfo.InvariantCulture to char.ToUpper if you need culture-independent behavior.)