How to Convert Case in Python โ Built-in Methods Guide
Published 2026-01-22 ยท convertcase.in
Python strings come with powerful built-in case conversion methods. Here's everything you need to know with real code examples.
Try it now โ free instant conversion
No signup ยท No limits ยท Works on all devices
1Python Case Methods
"hello".upper() โ "HELLO" "HELLO".lower() โ "hello" "hello world".title() โ "Hello World" "Hello World".swapcase() โ "hELLO wORLD" "hello world".capitalize() โ "Hello world"
2title() vs capitalize()
title() capitalises every word. capitalize() only capitalises the first character of the entire string.
3Custom Sentence Case
Python's capitalize() is close to sentence case, but title() is not. For proper sentence case, split on sentence-ending punctuation and capitalise each segment.
Frequently Asked Questions
Is Python's title() the same as title case?
Mostly, but it capitalises ALL words including "and", "the", etc. For strict title case, use a library like `titlecase`.
How do I convert to snake_case in Python?
"My Variable Name".lower().replace(" ", "_") โ "my_variable_name"