To check if a string is alphabet in Python, I reach for isalpha() first. A client’s CRM export of US customers showed me its limits: “New York” and “O’Neil” failed, while “José” passed a system that only takes A to Z.
Quick answer: value.isalpha() returns True when the string is not empty and every character is a letter. For English letters only, add isascii().
"Austin".isalpha() # True
"New York".isalpha() # False (space)
In this tutorial, I’ll show you how to check if a string is alphabet in Python for whole strings, A-to-Z text, names with spaces, single characters and pandas columns.
Every output below comes from Python 3.12.5 and pandas 3.0.6, run in VS Code.
How do you check if a string is alphabet in Python with isalpha()?
Here’s what you get from isalpha() on values from that export:
fields = ["Austin", "TX", "New York", "Route66", "", "José", "O'Neil"]
for value in fields:
print(f"{value!r:<11} -> {value.isalpha()}")
Output:
'Austin' -> True
'TX' -> True
'New York' -> False
'Route66' -> False
'' -> False
'José' -> True
"O'Neil" -> False

The empty string returns False, which suits required fields. I cover the method’s Unicode rules in what isalpha() does in Python.
Check for English letters A to Z only
isalpha() follows Unicode, so accented letters count. When a legacy system rejects them, you can use either of these checks:
import re
for value in ["Denver", "José", "Zoë", "Ohio2", ""]:
a = value.isascii() and value.isalpha()
b = re.fullmatch(r"[A-Za-z]+", value) is not None
print(f"{value!r:<9} isascii+isalpha={a!s:<5} regex={b}")
Output:
'Denver' isascii+isalpha=True regex=True
'José' isascii+isalpha=False regex=False
'Zoë' isascii+isalpha=False regex=False
'Ohio2' isascii+isalpha=False regex=False
'' isascii+isalpha=False regex=False

I’d pick isascii() and isalpha(); you can read it at a glance.
If underscores or digits are allowed too, see checking for alphanumeric characters and underscores.
Check if a string has only letters and spaces
Names and cities need separators. The popular all(ch.isalpha() or ch.isspace() ...) helper fails on blanks:
import re
NAME = re.compile(r"[A-Za-z]+(?:[ '-][A-Za-z]+)*")
def loose(s):
return all(ch.isalpha() or ch.isspace() for ch in s)
for value in ["New York", "Mary-Kate", "O'Neil", "Ann Lee", " ", ""]:
strict = NAME.fullmatch(value) is not None
print(f"{value!r:<11} all()={loose(value)!s:<5} regex={strict}")
Output:
'New York' all()=True regex=True
'Mary-Kate' all()=False regex=True
"O'Neil" all()=False regex=True
'Ann Lee' all()=True regex=False
' ' all()=True regex=False
'' all()=True regex=False

all() helper says True for an empty string and three spaces; the regex rejects both.all() is True for an empty sequence, so blanks slip through. The regex also rejects double spaces.
To find which symbol broke a value, see checking a string for special characters.
Check if a single character is a letter
A one-character string uses the same methods. Slicing with [:1] instead of [0] keeps an empty string from raising IndexError:
for ch in ["G", "7", "é", " "]:
print(f"{ch!r:<4} isalpha={ch.isalpha()!s:<5} ord={ord(ch)}")
for order_id in ["90210", "A1027", ""]:
print(f"{order_id!r:<8} starts with a letter: {order_id[:1].isalpha()}")
Output:
'G' isalpha=True ord=71
'7' isalpha=False ord=55
'é' isalpha=True ord=233
' ' isalpha=False ord=32
'90210' starts with a letter: False
'A1027' starts with a letter: True
'' starts with a letter: False
“é” is a letter with code point 233, outside A to Z. The Python ord() function helps you debug odd input like that.
Check a pandas column for letters only
For the full export, pandas runs these tests on whole columns:
import pandas as pd
df = pd.DataFrame({"first": ["Emily", "Jake2", "Ana Lucia", None],
"state": ["TX", "CA", "N.Y.", "fl"]})
df["first_ok"] = df["first"].str.isalpha()
df["state_ok"] = df["state"].str.fullmatch(r"[A-Z]{2}")
print(df)
Output:
first state first_ok state_ok
0 Emily TX True True
1 Jake2 CA False True
2 Ana Lucia N.Y. False False
3 NaN fl False False

In pandas 3 a missing name comes back False; older versions return NaN. You can then filter the DataFrame down to the rows to fix.
Common errors when checking for letters and how to fix them
Two mistakes I see most often:
import re
zip_code = 90210
try:
zip_code.isalpha()
except AttributeError as err:
print("AttributeError:", err)
print("str() first:", str(zip_code).isalpha())
print("match: ", bool(re.match(r"[A-Za-z]+", "Austin123")))
print("fullmatch:", bool(re.fullmatch(r"[A-Za-z]+", "Austin123")))
Output:
AttributeError: 'int' object has no attribute 'isalpha'
str() first: False
match: True
fullmatch: False

isalpha(), and re.match accepts “Austin123” while fullmatch doesn’t.Convert numbers with str() and anchor regexes with fullmatch. If a value might not be text, check that the variable is a string.
A few related string checks:
- The isdigit() method in Python
- Check if a string is all uppercase
- Remove numbers from strings
- Check if a string contains only numbers
Frequently asked questions
How do I check if a string contains only letters in Python?
Call s.isalpha(). It’s True only for non-empty, all-letter strings.
How do I allow spaces?
Use a regex fullmatch, so blank strings still fail.
Does isalpha() accept accented letters?
Yes. Use s.isascii() and s.isalpha() to allow only A to Z.
Why does isalpha() return False for an empty string?
It needs at least one character.
How do I check if a string has at least one letter?
Use any(ch.isalpha() for ch in s).
Where is isalpha() documented?
See str.isalpha() in the Python docs.