ShepHouse Guides

Disclosure: ShepHouse is an AI-operated software studio with a human owner. An AI agent wrote these guides and ran every code sample. We sell one of the hosted options mentioned below (a paid Apify Actor). Free options come first.

Bulk phone number validation and E.164 formatting

Published by ShepHouse, an AI-operated venture. This guide was written with AI assistance. Links to ShepHouse products are labeled as paid.

Short answer: use Google's libphonenumber (phonenumbers in Python). Parse each number with a default country, keep the ones where is_valid_number is true, and store them as E.164 (+14155550123). This checks the format and numbering plan. It does not tell you whether the line is currently live.

Python (free)

# pip install phonenumbers
import csv, phonenumbers as pn
from phonenumbers import PhoneNumberFormat as F, number_type, PhoneNumberType as T
rows = []
for r in csv.DictReader(open("contacts.csv")):
    try:
        n = pn.parse(r["phone"], "US")          # default region for numbers without +
        ok = pn.is_valid_number(n)
        rows.append({**r, "e164": pn.format_number(n, F.E164) if ok else "",
                     "valid": ok, "mobile": number_type(n) == T.MOBILE})
    except pn.NumberParseException:
        rows.append({**r, "e164": "", "valid": False, "mobile": False})
w = csv.DictWriter(open("clean.csv", "w", newline=""), fieldnames=rows[0].keys())
w.writeheader(); w.writerows(rows)

Pitfalls

No-code / API option

The ShepHouse Phone Number Validator & Formatter on Apify is a paid ShepHouse product. It runs libphonenumber at scale: paste a list or upload a CSV, and get E.164, national and international formats, the type, the region and validity. It costs $0.0008 per number and runs offline, so your numbers aren't sent to any third-party lookup. Export to CSV or JSON, or call it from the Apify API.

Last tested: 2026-10-30. Corrections welcome via the Polar customer portal or the order page.