str.istitle()

Check that a string matches str.title()'s output — a very strict definition that trips even short apostrophes.

String methodPython 1.0+Live demo
Common call
if headline.istitle():
Returns
True or False
Replaces
`s == s.title()` — but istitle is stricter about ambiguous cases
Watch out
Python's title case treats apostrophes as WORD BREAKS — "Don't" fails; "Don'T" passes
str.istitle()
bool

Demo

Live evaluation
Try:
Inputs
stringstrthe string to test
Output
'Hello World'.istitle()
True

istitle() applies Python's strict title-case definition: every uppercase character may ONLY follow a non-cased character (space, punctuation, digit, start of string). Every lowercase character may ONLY follow a cased character. The classic surprise: the apostrophe in "Don't" is non-cased, so the "t" after it should be uppercase — meaning "Don't" is NOT title case per Python, but "Don'T" is. This matches str.title() but rarely matches human intuition.

Common patterns

Validate a formatted headline
Confirm output of str.title() before serializing.
if not headline.istitle():
    raise ValueError("headline must be title case")
Skip already-titlecased strings
Avoid redundant work when already normalized.
if not text.istitle():
    text = text.title()
Detect one-word title-case identifiers
Class names in CamelCase almost always fail istitle — the pattern is subtly different.
# "MyClass".istitle() is False
# because "C" follows a cased "y"

Examples

1. Basic title
"Hello World".istitle()
Returns
True
2. All lower
"hello world".istitle()
Returns
False
3. All upper
"HELLO WORLD".istitle()
Returns
False
4. Single word
"Hello".istitle()
Returns
True
5. Apostrophe surprise
"Don\'t".istitle()
Returns
False # 't' should be 'T' after apostrophe
6. Quirky title
"Don\'T".istitle()
Returns
True # ...but this is title case!
7. Title + digits
"Chapter 1 Introduction".istitle()
Returns
True
8. Empty is False
"".istitle()
Returns
False

Pitfalls

1. Apostrophes count as word breaks
The single most surprising istitle result. Python treats the apostrophe as non-cased, so what looks like a normal contraction fails title-case: "Don't" is NOT title case, but "Don'T" IS. Matches str.title() behavior — both are strict in the same way.
Common contraction
"Don\'t Stop".istitle()
False
Weird but true
"Don\'T Stop".istitle()
True
2. CamelCase identifiers are NOT title case
Adjacent letters within a word cannot switch case in title case. "MyClass" fails because the "C" immediately follows a cased "y" without an intervening non-cased character.
CamelCase fails
"MyClass".istitle()
False
Space it out
"My Class".istitle()
True
3. Empty string returns False
Same rule across the is* family — empty is always False. istitle also requires at least one cased character.
Wrong expectation
"".istitle()
False
Guard first
s and s.istitle()
covers the empty case
4. Digits and punctuation are "word separators"
Any non-cased character resets the case expectation. "Chapter1Intro" is NOT title case (the 1 acts as a word separator, so the "I" should be preceded by lowercase, but it is preceded by a digit which resets).
Assumed pass
"Chapter1Intro".istitle()
True # actually True — digits reset the state
Read the docs — digits behave as non-cased

When to use

Use it
  • Validating that a headline has been passed through str.title()
  • Detecting non-normalized formatted text
  • Composing with capitalize / title / isupper / islower for finer checks
  • Confirming a string matches Python's specific title-case convention
Reach for something else
  • Human-friendly title case (which allows apostrophes) → custom regex
  • Detecting camelCase or PascalCase → different pattern entirely
  • Locale-aware title case → third-party library
  • You need "is capitalized" not "is title case" → check first char via s[0].isupper()

Notes

Complexity
O(n) — one linear scan
Return
bool — True or False
CPython impl
Objects/unicodeobject.c :: unicode_istitle
Memory
No allocation
Thread-safe
Yes — strings are immutable

FAQ

Because Python treats the apostrophe as a word break. After a word break, the next cased character should be uppercase — but "t" is lowercase. This matches str.title() output, which produces "Don'T".

History

1.0
istitle() has been part of str since Python 1.0.
3.0
Full Unicode support — checks per Unicode general category and case mapping.