1. Clean the input
Remove spaces, parentheses and hyphens while preserving the digits and country context.
+34 test data
Generate Spain phone number examples for development, QA, input masks and documentation. Results are not live subscriber lines.
| Calling code | +34 |
|---|---|
| National pattern | 6xx xxx xxx |
| E.164 example | +34612345678 |
| Typical length | 9 national digits |
Remove spaces, parentheses and hyphens while preserving the digits and country context.
Keep all 9 national digits and add +34; Spain does not use a domestic trunk zero for this mobile format.
Use +34612345678 for machine storage and format it for display at the edge of your application.
| Case | Fixture | Expected test behavior |
|---|---|---|
| National display | 6xx xxx xxx | Accept punctuation, then normalize. |
| Valid E.164 structure | +34612345678 | Accept for format testing; do not infer reachability. |
| Invalid length | +3461234567 | Reject before storing or sending to an API. |
Manually reviewed country notes
This Spanish mobile fixture uses a closed nine-digit national value beginning with 6. Add +34 without removing a trunk zero; the leading mobile digit is part of the subscriber number.
The CNMC numbering register is an allocation reference, not a fictional-number guarantee. The generated fixture may coincide with an assigned value and is restricted to development and QA.
Keep all nine national digits after +34.
Do not remove the leading 6 as if it were a trunk prefix.
Classify 6- and 7-prefixed mobile ranges with current metadata.
These cases document the fixture contract used by GetPhoneNum. They test parsing and normalization only; they never prove that a subscriber exists.
| Input | Expected result | Reason |
|---|---|---|
612 345 678 | +34612345678 | Add +34 to nine national digits |
+34 612 345 678 | +34612345678 | Normalize punctuation |
0034 612 345 678 | +34612345678 | Convert an access prefix |
0612 345 678 | Reject or review | This fixture has no domestic trunk zero |
612 345 67 | Reject | One digit short |
Reviewed by GetPhoneNum Editorial Team · Last reviewed August 11, 2026
Test empty input, pasted punctuation, a missing country code, one digit too few and one digit too many. Avoid using a single global regex for every country.
Test a JavaScript regexStore a normalized E.164 value and keep display formatting separate. Try the E.164 formatter or structural validator.
Numbering plans change. Use a maintained numbering library and treat carrier, line type and reachability as separate checks.
Browse calling-code referencesRelated generators and tools
They are generated test fixtures, not verified subscriber lines. Even a structurally valid value may coincide with an assigned number unless it comes from an officially reserved fictional range.
+34 is the international country calling code for Spain. In E.164 format it appears after the leading plus sign and before the national number.
No capability is provided or verified. Do not call, text or use generated values for account verification.
Numbering rules can change. Check the CNMC numbering register before enforcing production rules.
Create up to 100 local fixtures in the browser, download the open dataset, or use the API design reference to define a deterministic contract for automated test suites.