str.isupper()

str.isupper()
Returns: bool · Added in v3.x · Updated March 13, 2026 · String Methods
string methods character

The .isupper() method checks whether all cased characters in a string are uppercase and the string contains at least one cased character.

Syntax

str.isupper()

Parameters

None. This method takes no parameters.

Return Value

TypeDescription
boolTrue if all cased characters are uppercase, False otherwise

What Counts as “Cased”?

Only alphabetic characters (a-z and A-Z) are cased. Numbers, symbols, and spaces are ignored by .isupper(). If a string contains only digits or symbols, .isupper() returns False because there are no cased characters.

Examples

Basic usage

text = "HELLO"
print(text.isupper())  # True

text = "Hello"
print(text.isupper())  # False

text = "hello"
print(text.isupper())  # False

Mixed content

# Numbers are ignored - they don't affect the result
print("HELLO123".isupper())  # True

# Symbols are ignored too
print("HELLO!".isupper())    # True

# A single lowercase letter makes it False
print("HellO".isupper())     # False

Edge cases

# Empty string returns False
print("".isupper())          # False

# Only symbols returns False
print("!!!".isupper())       # False

# Only numbers returns False
print("123".isupper())       # False

Practical use case

def validate_code(code):
    """Check if a product code follows the UPPERCASE convention."""
    if not code.isupper():
        return False, "Code must be uppercase"
    return True, "Valid"

print(validate_code("ABC123"))  # (True, 'Valid')
print(validate_code("abc123"))  # (False, 'Code must be uppercase')
print(validate_code("Abc123"))  # (False, 'Code must be uppercase')

Common Mistakes

Many beginners mistakenly think .isupper() returns True for any string with uppercase letters. This is wrong. All cased characters must be uppercase:

# This returns False, not True!
print("Hello World".isupper())  # False - 'W' is lowercase in this check

See Also