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 DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk1 min

How to Check if a String Is All Uppercase in Python

Call text.isupper() to check whether a Python string has at least one cased character and all of its cased characters are uppercase.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Python’s str.isupper() method: text.isupper() returns True when the string contains at least one cased character and every cased character is uppercase. It returns False otherwise.

Check a Python string with isupper()

Call the method directly on the string you want to test:

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

This is a test of the original string, not a conversion. For Python 3.14.7, the official str.isupper() documentation defines the result by the string’s cased characters: they must all be uppercase, and there must be at least one.

How uncased characters affect the result

Spaces, punctuation, and digits are uncased characters. They do not make a string fail the test, but a string containing only uncased characters returns False because it has no cased character.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Expression Result Why
"HELLO".isupper() True All cased characters are uppercase.
"HELLO! 123".isupper() True The cased characters are uppercase; punctuation, spaces, and digits are uncased.
"Hello".isupper() False It contains a lowercase cased character.
"123".isupper() False It contains no cased characters.
"".isupper() False The empty string contains no cased characters.

Checking is different from converting

text.upper() returns a string with cased characters converted to uppercase; it does not directly answer whether the original string was uppercase. Use text.isupper() for that question. Python also documents that s.upper().isupper() can be false when the original string contains uncased characters or uppercasing produces a titlecase character. See the str.upper() documentation for the conversion behavior and caveat.

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

For str and bytes, the rules differ

Python str is Unicode text, so str.isupper() is not limited to ASCII letters. A bytes value has its own isupper() method: it returns true only if there is at least one uppercase ASCII alphabetic byte and no lowercase ASCII bytes. The bytes.isupper() documentation describes that separate rule; do not assume it has the same character scope as the Unicode string method.

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.