Spec 0.16.0
Madagascar phone numbers: rules and sources
Reads, checks and formats Malagasy phone numbers, mobile and fixed (country code +261).
-
A number has 9 significant digits after
+261: a 2-digit operator code, then 7 digits. -
Accepted spellings of the same number
34 12 345 67:034 12 345 67,+261 34 12 345 67,00261 34 12 345 67,261 34 12 345 67,34 12 345 67.0is the national trunk prefix;00is the international prefix.- Spaces (including non-breaking and other Unicode spaces),
-,.,(and)are ignored. A+is allowed only as the first character. - A
(0)written right after the country code is ignored:+261 (0)34 12 345 67is the same number as+261 34 12 345 67. - Any other character (letters,
_, full-width digits) isINVALID_FORMAT. - The 9 significant digits never start with
0, so034 12 345 6(one digit short) isINVALID_FORMAT, not a 9-digit number with operator03. - Input longer than
plan.maxInputLength(32) characters isINVALID_FORMAT, so parsers never scan unbounded text.
-
Operator codes 30–39 are mobile. Assigned codes:
Code Operator Assigned 32 Orange Madagascar 2013 plan 33 Airtel Madagascar 2013 plan 34 Yas Madagascar (formerly Telma) 2013 plan 35 Airtel Madagascar 22 Jun 2026 36 Yas Madagascar (formerly Telma) 2026 37 Orange Madagascar 21 Oct 2022 38 Yas Madagascar (formerly Telma) 21 Oct 2022 39 Blueline (MVNO) 21 Aug 2013 Codes 20–29 are fixed lines (2013 plan):
20is the Yas (Telecom Malagasy) fixed network,22is Gulfsat Madagascar VSAT. After20comes a zone digit (2 and 4 Antananarivo, 5 Toamasina, 6 Mahajanga, 7 Fianarantsoa, 8 Antsiranana, 9 Toliara), then 6 subscriber digits. A geographic number gives its town when the plan lists it (020 53 …→ Toamasina); otherwise itsareaisnull. A well-formed number with any other code, or a20number with an unlisted zone, isUNKNOWN_OPERATOR. -
Formats (
formatPhone):Format Output for 0341234567e164+261341234567international+261 34 12 345 67national034 12 345 67Any other format name is
INVALID_TYPE. -
Input is text, or a whole number read as its digits: a phone number stored as a number loses its leading
0, so341234567is+261 34 12 345 67. Any other type isINVALID_TYPEforparsePhoneandformatPhone;isValidPhonenever throws and returnsfalse. A port also takes the value its ownparsePhonereturned (a parsed number) wherever a phone number is read, so a number can be parsed once and formatted many times. -
Typing in a field (
formatPhoneInput): the text typed so far, grouped asformatPhonegroups it. Only digits and a leading+are kept. Text starting with+261is international (+261 34 12), text starting with0is national (034 12), and other digits are the national number (34 12). At most 9 national digits are kept. It never throws, never checks the operator, and nothing typed is''.
Parsed value
Section titled “Parsed value”e164: '+261341234567'nationalNumber: '341234567'operator: yastype: mobile # or fixedarea: null # for a geographic fixed number: { name: Toamasina, province: Toamasina }Sources
Section titled “Sources”- ITU, national numbering plan for Madagascar (+261), communications from OMERT (27.VIII.2013, 21.VIII.2013) and ARTEC (21.X.2022): https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200007F0002PDFF.pdf
- ARTEC, Plan national de numérotation: https://www.artec.mg/plan-national-de-numerotation/ (lists 32 Orange, 33 Airtel, 34 and 38 Telma; did not load over HTTPS when checked on 2026-11-23 because of a certificate error).
- Prefix 35 (Airtel Madagascar), numbers on sale since 22 June 2026: TechAfrica News, https://techafricanews.com/2026/06/22/airtel-madagascar-launches-new-035-prefix-to-support-network-growth/ (also reported by CapMad and Telecompaper). Not in the ITU filing yet.
- Prefix 36 (Yas Madagascar): announcement on the operator’s official Facebook page (“Tonga ny préfixe 036, manampy ny 034 sy 038”), https://www.facebook.com/YasMadagasikara/posts/-vaovao-ao-aminny-yas-madagascar-tonga-ny-pr%C3%A9fixe-036-manampy-ny-034-sy-038-1-00/1405609748336274/. Not in the ITU filing yet. Confirmed again by Yas on its Instagram page on 2026-12-02: https://www.instagram.com/p/Dcku7MPDLPM/. The prefix belongs to Yas, not Airtel.
- Fixed lines, zones and towns: the 27.VIII.2013 plan in the ITU document above.
- Telma renamed Yas Madagascar on 26 November 2024: L’Express de Madagascar,
https://www.lexpress.mg/2024/11/telephonie-mobile-telma-change-de-nom.html.
The operator id changed from
telmatoyasin spec 0.6.0.
Recorded disagreements
Section titled “Recorded disagreements”- Grouping for 39. The 2013 Blueline communication writes
+261 39 XXX XXXX; the 2013 plan and the 2022 communication write+261 3X XX XXX XX. The data uses the 2-2-3-2 grouping for every operator so one number always looks the same. - Is 39 still active? The ITU record does not withdraw 39. Until an official withdrawal is published, the data keeps it.
- 37 on the ARTEC page. The ARTEC web page does not list 37; the ITU communication of 21 Oct 2022 assigns it to Orange Madagascar. The data follows the ITU communication, which is the later and formal notice.
Recorded decisions
Section titled “Recorded decisions”- Forgiving input (rules 2 and 5). On 2026-12-02 the project lead asked that developers need no
cleanup code: a
(0)after the country code is ignored, and a whole number is read as its digits. Other input rules are unchanged.