str.lower()

Lowercase every cased character — the standard first step for case-insensitive comparison.

String methodPython 2.0+Live demo
Common call
"Hello".lower()
Returns
new str — original unchanged
Replaces
digits and punctuation pass through untouched
Watch out
for caseless MATCHING of arbitrary Unicode, casefold() is stricter
str.lower()
str

Demo

Live evaluation
Try:
Inputs
stringstrthe source
Output
'Hello World'.lower()
'hello world'

Every character with a lowercase form is converted; everything else — digits, punctuation, already-lowercase letters — passes through unchanged.

Common patterns

Case-insensitive comparison
Normalize both sides before comparing.
if answer.lower() == "yes":
    proceed()
Normalize keys
Store and look up dictionary keys in one canonical case.
index[word.lower()] = entry
Slug building
Typically chained after replace.
slug = title.replace(" ", "-").lower()

Examples

1. Basic lowercasing
"Hello World".lower()
Returns
'hello world'
2. Digits and punctuation
"ABC-123!".lower()
Returns
'abc-123!'
3. Unicode letters
"CAFÉ".lower()
Returns
'café'
4. Already lowercase
"hello".lower()
Returns
'hello'

Pitfalls

1. The result must be assigned
Strings are immutable — lower returns a new string.
Wrong
s = "HI"
s.lower()
print(s)
HI
Fix
s = s.lower()
print(s)
hi
2. Some Unicode needs casefold, not lower
German ß lowercases to itself, but casefolds to "ss" — lower() misses such matches.
Misses
"straße".lower() == "STRASSE".lower()
False
Fix
"straße".casefold() == "STRASSE".casefold()
True

When to use

Use it
  • Case-insensitive equality between ASCII-ish strings
  • Normalizing identifiers, emails, slugs for storage
  • Display text that must be lowercase
Reach for something else
  • Caseless matching of arbitrary Unicode → str.casefold
  • Only the first letter → str.capitalize
  • Swapping case → str.swapcase

Notes

Complexity
O(n)
Return
new str — source untouched
CPython impl
Objects/unicodeobject.c :: do_lower
Memory
One new string (may differ in byte size for some Unicode)
Thread-safe
Yes — str is immutable

FAQ

casefold is a more aggressive lowercasing designed for caseless matching — it also maps characters like ß to ss. For ASCII they behave the same; for comparing arbitrary Unicode, prefer casefold.

History

3.3
Related: str.casefold added for caseless matching.
2.0
Method available on the unified string type.