Convert All Uppercase Letters to Lowercase in Python



We can convert all uppercase letters in a string to lowercase in Python using the lower() function. You can also use a for loop or list comprehension to change each character to lowercase one by one. This is helpful when you want to compare strings without worrying about letter cases.

Using lower() Function

The Python lower() function returns a new string with all uppercase letters converted to lowercase, keeping the lowercase letters unchanged.

It does not modify the original string and is commonly used when comparing strings or handling user input.

Example

In the following example, we convert an entire string with uppercase characters to lowercase using the lower() function -

text = "HELLO Python WORLD"
lowercase_text = text.lower()
print(lowercase_text)

The result produced is as follows -

hello python world

Using for loop with isupper() and lower()

We can convert uppercase letters to lowercase by iterating through each character in the string. For every character, if the isupper() function returns true (indicating it is uppercase), we convert that character to lowercase using the lower() function.

Example

In this example, we use a loop to check each character and create a new string with all lowercase letters -

text = "Hello PYTHON"
result = ""

for ch in text:
   if ch.isupper():
      result += ch.lower()
   else:
      result += ch

print(result)

The output obtained is as shown below -

hello python

Using List Comprehension

We can also use Python List Comprehension to check each character in the string, convert uppercase letters to lowercase, and then combine all characters back into a single string. This performs the conversion in one line.

Example

In the following example, we create a new lowercase string using list comprehension -

text = "Python IS Fun"
lowercase_text = ''.join([ch.lower() for ch in text])
print(lowercase_text)

We get the output as shown below -

python is fun
Updated on: 2025-06-11T17:08:38+05:30

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started