---
title: "Show and accept phone numbers in each · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/formatting/phone-number-formats
id: LOC-55
level: Recommended
updated: 2026-10-22
build: a2a6bdfed830
tokens: 782
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Show and accept phone numbers in each country's format

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Formatting](https://agentwranglers.se/playbook/localization/formatting.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-55
- Level: Recommended
- Chapter: [Formatting](https://agentwranglers.se/playbook/localization/formatting.md)
- Rule: Accept phone numbers as people write them in their country. Show each one in the reader's national or international format with a phone number library.
- Check: A unit test parses "070-123 45 67" with the country SE and gets `+46701234567`. It formats that number back as "070-123 45 67" for SE and as "+46 70 123 45 67" for other countries.
- How: "070-123 45 67" is a Swedish mobile number only once you know the country. Ask for the country with the number, or default it from the address or locale. Parse with libphonenumber or a port of it, and store the result as [Store phone numbers in E.164](https://agentwranglers.se/playbook/notifications/text-messages/e164-phone-numbers.md) says. Show the national format to readers in the same country, and the international format to everyone else. Use `type="tel"` and `autocomplete="tel"` on the field, and never strip a leading `+` or `0` by hand.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
import { parsePhoneNumber } from 'libphonenumber-js';
const phone = parsePhoneNumber('070-123 45 67', 'SE');
phone.number;                 // '+46701234567'
phone.formatNational();       // '070-123 45 67'
phone.formatInternational();  // '+46 70 123 45 67'
```

### Python example

```python
import phonenumbers
from phonenumbers import PhoneNumberFormat
phone = phonenumbers.parse("070-123 45 67", "SE")
phonenumbers.format_number(phone, PhoneNumberFormat.E164)           # '+46701234567'
phonenumbers.format_number(phone, PhoneNumberFormat.NATIONAL)       # '070-123 45 67'
phonenumbers.format_number(phone, PhoneNumberFormat.INTERNATIONAL)  # '+46 70 123 45 67'
```

## Sources

- [ITU-T E.164](https://www.itu.int/rec/T-REC-E.164)

## Related rules

- NTF-26 [Store phone numbers in E.164](https://agentwranglers.se/playbook/notifications/text-messages/e164-phone-numbers.md) in Notifications

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/formatting/phone-number-formats">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Format lists and durations with locale data](https://agentwranglers.se/playbook/localization/formatting/list-and-duration-formats.md)
- [Formatting](https://agentwranglers.se/playbook/localization/formatting.md)
