Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk1 min

How to Convert a String to Lowercase in Python

Use Python’s str.lower() to return a lowercase copy of text. For caseless matching, choose casefold(); bytes.lower() only converts ASCII uppercase bytes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call .lower() on a Python string: "Hello, WORLD!".lower() returns "hello, world!". Because the method returns a converted string rather than changing the original, assign the result if you need to keep it.

Use str.lower() for ordinary text

Python’s str.lower() returns a copy of the string with its cased characters converted to lowercase, using Unicode lowercasing. For example:

text = "Hello, WORLD!"
lowercase_text = text.lower()

print(lowercase_text)  # hello, world!

The original value in text remains unchanged; the converted value is returned and stored in lowercase_text. You can also use the result directly, such as print(text.lower()). Punctuation and other uncased characters are not converted. See the Python 3.10 built-in types documentation.

Choose lower() or casefold() by purpose

For lowercase text to display or normalize, use lower(). For caseless comparison or matching, use casefold(), which is more aggressive and can change characters beyond their capitalization. For example, "ß".lower() remains "ß", while "ß".casefold() becomes "ss", as shown in the Python documentation for casefold().

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check whether your value is str or bytes

Use str.lower() when your value is decoded text. A bytes value has a separate .lower() method that converts ASCII uppercase byte values; it is not Unicode-aware text lowercasing. If your bytes contain text and you need Unicode casing, decode them to a string first. Python documents the distinction in its pages for str.lower() and bytes.lower().

Method Input Use
str.lower() Unicode text (str) Convert cased characters to lowercase.
str.casefold() Unicode text (str) More aggressive conversion for caseless matching.
bytes.lower() Binary sequence (bytes) Convert ASCII uppercase byte values.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.