What is the name of the method you call on a string to make it all uppercase?

The story behind the answer

The string method that makes text uppercase in Python is `upper()`.

Called on a string object, `upper()` returns a new string with applicable lowercase letters converted to uppercase: for example, `"hello".upper()` produces `"HELLO"`. Python strings are immutable, so the original string is not changed; the returned value must be stored if the converted text is needed later.

A frequent mistake is choosing `capitalize()`. That method uppercases the first character and generally lowercases the remaining characters, so `"hELLO".capitalize()` becomes `"Hello"`, not `"HELLO"`. `toupper()` and `uppercase()` are not standard Python string methods. Similar methods include `lower()`, `casefold()`, `swapcase()`, and `title()`.

The method also handles many Unicode characters according to their defined case mappings, making it more capable than a simple ASCII-only conversion. For case-insensitive comparisons, however, `casefold()` is often preferable because it is designed for more aggressive Unicode-aware matching. `upper()` is best understood as a formatting or presentation operation.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: