Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Difference between casefold() and lower() in Python
Next article icon

Difference between casefold() and lower() in Python

Last Updated : 01 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will learn the differences between casefold() and lower() in Python. The string lower() is an in-built method in Python language. It converts all uppercase letters in a string into lowercase and then returns the string. Whereas casefold() method is an advanced version of lower() method, it converts the uppercase letter to lowercase including some special characters which are not specified in the ASCII table for example 'ß' which is a German letter and its lowercase letter is 'ss'.

lower() method in Python

In this example, we have stored a string in variable 's1' which includes uppercase letters, and converted it to lowercase using the lower() method.

Syntax of lower(): string.lower()
Parameters: It does not take any parameter.
Returns: It returns a lowercase string of the given string.

Python
s1 = "GeeksForGeeks"  s2 = s1.lower() print(s2) 

Output
geeksforgeeks 

casefold() method in Python

In this example, we have stored a German letter 'ß' in 's1' and converted it to lowercase using both methods casefold() and lower() and we can see in the output that casefold() converts it to lowercase whereas using lower(), the letter is printed as it is after conversion.

Syntax of casefold(): string.casefold()
Parameters: It does not take any parameter.
Returns: It returns a lowercase string of the given string.

Python
s1 = "ß"  s2 = s1.casefold() print("Using casefold() - ",s2)  s3 = s1.lower() print("Using lower() - ",s3) 

Output
Using casefold() -  ss Using lower() -  ß 

Difference between lower() and casefold() in Python

Featurelower()casefold()
PurposeConverts uppercase letters to lowercase.Converts uppercase letters to lowercase, including special characters and locale-specific cases.
Handling of Special CharactersDoesn't handle special or language-specific cases.Handles special cases like German "ß" (sharp S) correctly (e.g., "ß".casefold() => "ss").
Use CaseBasic lowercase conversion for general text processing.Best for case-insensitive comparisons, especially for multilingual text.
Example"HELLO".lower() => "hello""HELLO".casefold() => "hello"
Example with Special Characters"ß".lower() => "ß""ß".casefold() => "ss"

Next Article
Difference between casefold() and lower() in Python

S

sagar99
Improve
Article Tags :
  • Python
  • Python-Functions
  • Python-Built-in-functions
Practice Tags :
  • python
  • python-functions

Similar Reads

    Difference between str.capitalize() and str.title()
    The primary difference between str.capitalize() and str.title() lies in their scope of capitalization. str.capitalize() only capitalizes the first character of the entire string and str.title() capitalizes the first character of every word in the string. Let's understand both str.capitalize() and st
    2 min read
    Conditional Decorators in Python
    In Python, decorators are functions or classes that wrap around a function as a wrapper by taking a function as input and returning out a callable. They allow the creation of reusable building code blocks that can either change or extend behavior of other functions. Conditional Decorators Given a co
    2 min read
    isupper(), islower(), lower(), upper() in Python and their applications
    Python provides several built-in string methods to work with the case of characters. Among them, isupper(), islower(), upper() and lower() are commonly used for checking or converting character cases. In this article we will learn and explore these methods:1. isupper() MethodThe isupper() method che
    2 min read
    Python String casefold() Method
    Python String casefold() method is used to convert string to lowercase. It is similar to the Python lower() string method, but the case removes all the case distinctions present in a string. Python String casefold() Method Syntax Syntax:  string.casefold() Parameters: The casefold() method doesn't t
    1 min read
    How to lowercase strings in a column in Pandas dataframe
    Analyzing real-world data is somewhat difficult because we need to take various things into consideration. Apart from getting the useful data from large datasets, keeping data in required format is also very important. One might encounter a situation where we need to lowercase each letter in any spe
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences