How to Validate International Phone Numbers in JavaScript (2026)
Phone number validation sounds simple until you go international. US numbers have 10 digits, UK mobiles have 11, German numbers range from 7 to 12, and India uses a completely different prefix system. A basic regex that works for one country breaks on all the others. This guide covers four approaches, from simple to production-grade, with working code for each. The Problem with Simple Regex Most developers start here: // DON'T use this in production const isPhone = /^ \d{10} $/ . test ( input ); // Misses: +44 7911 123456, 0049 170 1234567, +91 98765 43210 This only matches exactly 10 digits. It rejects every valid international number, numbers with country codes, parentheses, dashes, or spaces. It also accepts invalid 10-digit strings that aren't real phone numbers. Approach 1: Country-Specific Regex Patterns Instead of one regex, use a separate pattern per country: const patterns = { US : /^1 ?([ 2-9 ]\d{2}[ 2-9 ]\d{6}) $/ , GB : /^ (?: 44 )? 0 ?( 7 \d{9} | [ 1-9 ]\d{8,9}) $/ , DE :
Continue reading on Dev.to JavaScript
Opens in a new tab



