Python String lower() Method

Short answer
text.lower() returns a new string with every uppercase letter converted to lowercase; characters without case are unchanged.

lower() is the everyday tool for making text uniform before you compare, count or search it: "Yes", "YES" and "yes" all become "yes". It takes no arguments and leaves the original string alone.

Its counterpart is upper(). When you must compare text from different languages, read the section on casefold() below.

Quick facts
Syntaxtext.lower()
ParametersNone
ReturnsA new str with cased characters in lowercase
Time complexityO(n) in the length of the string

How lower() converts text to lowercase

Each uppercase letter is replaced by its lowercase form; digits, spaces and punctuation stay as they are. The result is a new object.

Python
print("Order PLACED at 9AM".lower())
print("ABC-123".lower())

lower() vs casefold() for case-insensitive comparison

casefold() is a stronger version of lower() designed for comparing text. It converts characters that lower() leaves alone, such as the German ß, which becomes ss. For English-only data both work; for text in many languages, prefer casefold().

Python
print("Stra\u00dfe".lower() == "STRASSE".lower())
print("Stra\u00dfe".casefold() == "STRASSE".casefold())

Choosing between lower(), upper() and casefold()

MethodUse it forResult for "Python Rocks"
lower()Display and normal comparisons'python rocks'
casefold()Comparing text from many languages'python rocks'
upper()Codes and emphasis'PYTHON ROCKS'
islower()Checking, not convertingFalse
title()Headings and names'Python Rocks'

Making user input and searches case-insensitive

Convert both sides of a comparison, not just one. A typical pattern is answer.strip().lower() for input and name.lower() in text.lower() for searches. See comparing strings ignoring case and checking if a string contains a substring.

Examples you can run

Press Run, then edit the code and run it again.

Convert to lowercase

The original variable keeps its value.

Convert to lowercase
title = "Learn PYTHON Fast"
print(title.lower())
print(title)
Expected outputlearn python fast
Learn PYTHON Fast

Case-insensitive yes/no check

Normalise the typed answer first.

Case-insensitive yes/no check
for reply in ["Yes", "YES", "no", " y "]:
    print(reply.strip().lower() in ("yes", "y"))
Expected outputTrue
True
False
True

Case-insensitive search in text

Lower-case both the text and the word.

Case-insensitive search in text
review = "Great Battery, great screen"
word = "GREAT"
print(review.lower().count(word.lower()))
Expected output2

Common mistakes

Lowercasing only one side of a comparison

✗ Wrong

email = "Asha@Mail.com"
print(email.lower() == "Asha@Mail.com")
False

✓ Right

email = "Asha@Mail.com"
print(email.lower() == "asha@mail.com")

Lower-case both strings or compare with a lowercase literal.

Expecting lower() to change the variable

✗ Wrong

word = "HELLO"
word.lower()
print(word)
HELLO (unchanged)

✓ Right

word = "HELLO"
word = word.lower()
print(word)

Assign the result: word = word.lower().

Calling lower() on a list

✗ Wrong

items = ["A", "B"]
print(items.lower())
AttributeError: 'list' object has no attribute 'lower'

✓ Right

items = ["A", "B"]
print([i.lower() for i in items])

Apply lower() to each string item instead.

Python String lower() Method: questions people ask

How do I convert a string to lowercase in Python?

Use text.lower(), which returns a new string with all letters in lowercase.

What is the difference between lower() and casefold()?

casefold() is more aggressive and handles special letters such as ß, so it is better for caseless matching across languages; lower() is fine for everyday English text.

How do I ignore case when comparing strings in Python?

Convert both strings with lower() (or casefold()) before comparing them.

Keep learning

Step-by-step lessons:
Python StringsPython String Methods

Related:
Python String upper() MethodHow to Compare Strings Ignoring Case in PythonPython String title() MethodPython String swapcase() MethodPython String strip() Method

More in string methods:
Python String split() MethodPython String join() MethodPython String strip() MethodPython String lstrip() MethodPython String rstrip() MethodPython String replace() MethodPython String upper() MethodPython String title() Method See all →