lower() makes every letter in a string lower case, so "HeLLo" becomes "hello". Digits, spaces, and punctuation have no case, so they stay exactly as they were.
A string is immutable, so lower() never edits the string you call it on. It builds and returns a new string, and you decide whether to print it or store it. It is the standard first step before comparing text, such as emails or commands, without caring about capital letters.
text.lower() is a method of the built-in str type: call it on a string with dot notation. No import is needed, and it never changes the original string.
Syntax
Call it on any string. There are no arguments, but the parentheses are required.
python
result = text.lower()
Call
What it does
"PyThOn".lower()
Returns 'python'.
"ABC 123!".lower()
Returns 'abc 123!'. Digits, spaces, and symbols are left alone.
"already lower".lower()
Returns 'already lower', a new string with the same content.
For case-insensitive comparisons of international text, casefold() is stronger. To change the other way use upper(), and to capitalize only the first letter use capitalize().
Library declarations
python
str.lower() -> str
# returns: a new string; the original is unchanged
# raises: nothing (works for any string)
Parameters
lower() takes no arguments. It always works on the whole string.
Return Value
Return Value
Description
str
A new string in which every cased character is lower case. The original string is not changed.
Python Examples
Example 1 — Convert a Title to Lower Case
Call lower(), then check that the original string is untouched.
python
title = "Hello, PYTHON World!"
small = title.lower()
print(small)
print(title)
print(small == "hello, python world!")
Output
hello, python world!
Hello, PYTHON World!
True
How It Works
A new string.lower() returns "hello, python world!" and stores it in small.
The original stays.title still prints with its capital letters, because strings cannot be edited in place.
Punctuation is kept. The comma, space, and exclamation mark have no case, so the comparison with the all-lower text is True.
Example 2 — Compare Text Without Caring About Case
Clean up what a user typed, then compare it with a saved value and with a command.
python
saved = "Admin"
typed = " ADMIN "
print(typed.strip().lower() == saved.lower())
print(typed == saved)
for command in ["Start", "STOP", "Pause"]:
if command.lower() == "stop":
print("stopping")
Output
True
False
stopping
How It Works
Lower both sides.typed.strip().lower() removes the extra spaces and the capitals, and saved.lower() does the same for the saved name, so they match.
A plain comparison is strict.typed == saved is False, because " ADMIN " and "Admin" are different strings.
Commands in any case. Only "STOP" equals "stop" once lowered, so the loop prints one line.
Example 3 — Treat Emails in Different Cases as the Same
Lower every address, then let a set drop the duplicates.