Python bytes.istitle() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
bytes method

Definition

bytes.istitle() returns True if the data contains at least one ASCII letter, every uppercase letter follows a non-letter (or starts the data), and every lowercase letter follows a letter.

In other words, each word must look like Word. It uses the same word rule as title(), so data.title().istitle() is True for any data that contains a letter.

bytes.istitle() is a method of the built-in bytes type: call it on a bytes object with dot notation, such as data.istitle(...). No import is needed, and bytearray objects have the same method.

Syntax

No arguments; returns a bool.

python
result = data.istitle()
CallWhat it does
b"Hello World".istitle()Returns True.
b"Hello world".istitle()Returns False.
b"Content-Type".istitle()Returns True.

All-uppercase words such as b"HTTP" are not title case: the T after H is uppercase but follows a letter.

Method signatures
python
bytes.istitle()
# returns True or False; bytearray.istitle() works the same way

Parameters

istitle() takes no parameters.

Return Value

Return ValueDescription
TrueTitle-cased ASCII words, with at least one letter.
FalseAny word breaks the rule, or there are no ASCII letters.

Python Examples

Example 1 — Which Byte Strings Are Title Case?

Test a title, a sentence, an acronym, a header name, and a number.

python
for s in [b"Hello World", b"Hello world", b"HELLO", b"Content-Type", b"123"]:
    print(s, s.istitle())

How It Works

  1. Every word capitalized. Hello World passes.
  2. Lowercase word. world starts with a lowercase letter after a space.
  3. Acronyms fail. In HELLO, uppercase letters follow other letters.
  4. Hyphen starts a word. Content-Type passes, while 123 fails for having no letters.

Example 2 — Names That title() Changes

Check names before and after calling title(): the result always passes, but it is not always what a human expects.

python
for name in [b"mcdonald", b"McDonald", b"o'neil"]:
    print(name.istitle(), name.title(), name.title().istitle())

How It Works

  1. Inner capital fails. In McDonald, the D follows a letter, so it is not title case.
  2. title() flattens it. Both spellings become b'Mcdonald', which passes the check.
  3. Apostrophe breaks words. title() capitalizes the N after the apostrophe, and the repr switches to double quotes because the result contains '.

Example 3 — Accented Words as Text and as Bytes

The French word for school starts with an accented capital. Compare the str check, its UTF-8 bytes, and a byte string where the first ASCII letter is uppercase.

python
word = "\u00c9cole"

print(word.istitle())
print(word.encode("utf-8").istitle())
print(b"\xc3\x89Cole".istitle())

How It Works

  1. str is correct. U+00C9 is an uppercase letter followed by lowercase ones.
  2. bytes miss the capital. The accent bytes are not letters, so c looks like the start of a word and is lowercase.
  3. ASCII capital after the bytes. With an uppercase C after the non-ASCII bytes, the bytes rule is satisfied.

Frequently Asked Questions

That every run of ASCII letters starts with an uppercase letter followed only by lowercase letters, and that there is at least one letter.
The T, T, and P are uppercase but follow a letter. Title case allows only one capital at the start of each word.
Yes. Any non-letter byte separates words, so b"Content-Type".istitle() is True.
Yes, whenever the data contains at least one ASCII letter.
Not on bytes. Decode to str and use str.istitle().

Next: bytes.isupper()

True if there is at least one ASCII uppercase letter and no ASCII lowercase letters.

isupper() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful