← Back to Blog
Python

How to Convert Lowercase to Uppercase in Python

April 4, 2026 · 5 min read

Python has built-in string methods that make converting lowercase to uppercase simple. Here are the methods you need to know.

The .upper() Method

The most common way to convert lowercase to uppercase in Python:

text = "hello world"

result = text.upper()

# Output: "HELLO WORLD"

This converts every character to its uppercase version. Numbers, spaces, and special characters are not affected.

The .lower() Method

The opposite — converts uppercase to lowercase:

text = "HELLO WORLD"

result = text.lower()

# Output: "hello world"

The .capitalize() Method

Capitalizes only the first letter of the string:

"hello world".capitalize()

# Output: "Hello world"

The .title() Method

Capitalizes the first letter of every word:

"hello world".title()

# Output: "Hello World"

The .swapcase() Method

Flips every character — uppercase becomes lowercase and vice versa:

"Hello World".swapcase()

# Output: "hELLO wORLD"

All these methods return a new string. The original string is not modified. Strings in Python are immutable.

Converting a List of Strings

Use a list comprehension to convert multiple strings:

words = ["hello", "world", "python"]

upper_words = [w.upper() for w in words]

# Output: ["HELLO", "WORLD", "PYTHON"]

Reading from a File

Convert an entire file to uppercase:

with open("input.txt") as f:

    content = f.read().upper()

Quick Reference Table

.upper() — ALL UPPERCASE

.lower() — all lowercase

.capitalize() — First word only

.title() — Every Word Capitalized

.swapcase() — fLIP cASE

These are the most common ways to handle case conversion in Python. For quick non-coding conversions, use our free online case converter tool instead.

Try the Case Converter →