Country Code Validator (Free Online Tool)
Check whether a phone number's international calling code matches its declared ISO country code.
Paste your JSON → Get results instantly (no signup)
⚡ Instant resultsNo signupRuns in your browser
Try examples:
→ Validate that a US phone number declares country_code "US".
Output✓
Output✓
1{2 "valid": true,3 "country_code": "US",4 "expected_calling_code": "+1",5 "actual_calling_code": "+1",6 "message": "Phone country code matches country_code."7}Love the result?
Use this exact pipeline in your app, backend, or LLM workflow.
No setup needed. Works with curl, Node, Python.
Uses example data. For edited input, copy from the playground.
Works with:
- API responses
- Nested JSON
- Arrays & objects
Example: input → output
Input / OutputInputOutput
Related tools
Advanced usage (optional)
Country Code Validator
v1.0.0Validation
objectreversible
Description
Country Code Validator (validation.country-code)
Checks whether a phone number's international calling code matches a declared ISO 3166-1 alpha-2 country code.
When to use
- KYC and onboarding sanity checks
- Marketplace seller signups
- Fintech account creation flows
- Fraud screening (calling-code mismatch is a low-effort signal)
- Partner API validation
Modes
report(default): replaces the input with a check result envelope. Use when the validator is the final step.augment: preserves the input and adds an_country_checksub-object. Use when the validator runs mid-pipeline and downstream steps need the original record.
V1 scope
- Lookup covers ~40 of the most-common ISO codes (US, GB, DE, FR, JP, CN, IN, BR, MX, AU, ...). Unknown codes return
{ valid: false, message: "Unknown ISO country code" }. - Phone parsing is intentionally lightweight: strips
[\s\-()], requires a leading+, and prefix-matches against the expected calling code.
Not in V1 (deferred)
- Full libphonenumber-grade phone parsing
- Country name → ISO code lookup (use
cleanup.map-valueswith a prefilled table for now) - ISO2 ↔ ISO3 conversion
- Allowed-country / sanctions / high-risk country list
- Address country matching
Configuration
| Name | Type | Default | Description |
|---|---|---|---|
| Country code field | string | country_code | Top-level field holding the ISO 3166-1 alpha-2 country code (e.g. "US", "GB"). |
| Phone field | string | phone | Top-level field holding the phone number in international format (e.g. "+12025550123"). |
| Output mode | enum | report | report: replaces the input with the check result. augment: preserves the input and adds an `_country_check` sub-object. report augment |
Examples
AI Prompt
Validate that a US phone number declares country_code "US".Output✓
Output✓
1{2 "valid": true,3 "country_code": "US",4 "expected_calling_code": "+1",5 "actual_calling_code": "+1",6 "message": "Phone country code matches country_code."7}Config
Country code field
country_code
Phone field
phone
Output mode
report
API Usage
POST /api/v1/utilities/validation.country-code
Example:
curl -X POST https://your-domain.com/api/v1/utilities/validation.country-code \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":{"primary":{"country_code":"US","phone":"+1 (202) 555-0123"}},"config":{"countryCodeField":"country_code","phoneField":"phone","mode":"report"}}'Response
1{2 "valid": true,3 "country_code": "US",4 "expected_calling_code": "+1",5 "actual_calling_code": "+1",6 "message": "Phone country code matches country_code."7}