Skip to content
Sendozi

Developers

Nigerian phone number formats for developers

A Nigerian mobile number in E.164 format is +234 followed by ten digits, where the local leading 0 is dropped: 08012345678 becomes +2348012345678. Storing numbers in E.164 and normalising at the point of entry removes most SMS delivery failures caused by formatting.

By SendoziUpdated 4 min read

What is the correct format for a Nigerian phone number?

In international E.164 form it is +234 followed by ten digits: +2348012345678. The local form of the same number is 08012345678 - the same ten digits with a national trunk prefix 0 in front of them. Converting between the two is simply removing or adding that leading 0.

The same number in the forms you will encounter
FormExampleUse it for
E.164+2348012345678Storage, APIs, deduplication - the only form Sendozi accepts
International without plus2348012345678Some gateways and CSV exports; accepted by Sendozi
Local national08012345678What Nigerian users type. Normalise before use.
Spaced local0801 234 5678Display and print. Strip the spaces before validating.
Dialling-prefix international002348012345678Legacy exports. Replace the leading 00 with +.
The same number in the forms you will encounter

How the ten digits are structured

A Nigerian mobile number is a three-digit network prefix followed by seven subscriber digits. The prefix always begins 70, 71, 80, 81, 90 or 91 - which is why a validator can reject a great deal of rubbish cheaply, before any network is involved.

The pattern Sendozi validates against
Regular expression
^\+?234[789][01]\d{8}$
  • 234 - the Nigerian country code.
  • [789][01] - the first two digits of the mobile prefix: 70, 71, 80, 81, 90 or 91.
  • Eight further digits, completing the ten-digit national number.
  • The leading + is optional on input; Sendozi normalises it back on.

Normalising a number

  1. 1

    Strip everything that is not a digit or a leading plus

    Spaces, hyphens, brackets and non-breaking spaces pasted from spreadsheets.

  2. 2

    Replace a leading 00 with +

    The international dialling prefix in E.164 form is +.

  3. 3

    If it starts with 0 and is 11 digits, replace the 0 with +234

    This is the common Nigerian local form.

  4. 4

    If it starts with 234, prefix +

    Already international, just missing the plus.

  5. 5

    If it is 10 digits starting 7, 8 or 9, prefix +234

    A number entered without the trunk 0, which happens on forms that show a +234 prefix beside the field.

  6. 6

    Validate the result against the pattern

    Reject anything that does not match, rather than sending it and paying for the failure.

Normalisation you can paste into a project. Each returns E.164 or null.
TypeScript
const NIGERIAN_MOBILE = /^\+234[789][01]\d{8}$/;

export function normaliseNigerianMobile(input: string): string | null {
  let value = input.trim().replace(/[\s()\-.]/g, "");

  if (value.startsWith("00")) value = `+${value.slice(2)}`;
  if (/^0\d{10}$/.test(value)) value = `+234${value.slice(1)}`;
  else if (/^234\d{10}$/.test(value)) value = `+${value}`;
  else if (/^[789][01]\d{8}$/.test(value)) value = `+234${value}`;

  return NIGERIAN_MOBILE.test(value) ? value : null;
}
Python
import re

NIGERIAN_MOBILE = re.compile(r"^\+234[789][01]\d{8}$")
_STRIP = re.compile(r"[\s()\-.]")


def normalise_nigerian_mobile(raw: str) -> str | None:
    value = _STRIP.sub("", raw.strip())

    if value.startswith("00"):
        value = "+" + value[2:]
    if re.fullmatch(r"0\d{10}", value):
        value = "+234" + value[1:]
    elif re.fullmatch(r"234\d{10}", value):
        value = "+" + value
    elif re.fullmatch(r"[789][01]\d{8}", value):
        value = "+234" + value

    return value if NIGERIAN_MOBILE.fullmatch(value) else None
PHP
<?php

function normaliseNigerianMobile(string $raw): ?string
{
    $value = preg_replace('/[\s()\-.]/', '', trim($raw));

    if (str_starts_with($value, '00')) {
        $value = '+' . substr($value, 2);
    }

    if (preg_match('/^0\d{10}$/', $value)) {
        $value = '+234' . substr($value, 1);
    } elseif (preg_match('/^234\d{10}$/', $value)) {
        $value = '+' . $value;
    } elseif (preg_match('/^[789][01]\d{8}$/', $value)) {
        $value = '+234' . $value;
    }

    return preg_match('/^\+234[789][01]\d{8}$/', $value) ? $value : null;
}
SQL (PostgreSQL)
-- Normalise an existing column in place, then keep the constraint.
update contacts
set phone = '+234' || right(regexp_replace(phone, '[^0-9]', '', 'g'), 10)
where phone !~ '^\+234[789][01][0-9]{8}$'
  and right(regexp_replace(phone, '[^0-9]', '', 'g'), 10) ~ '^[789][01][0-9]{8}$';

alter table contacts
  add constraint contacts_phone_e164
  check (phone ~ '^\+234[789][01][0-9]{8}$');

Validation traps that cost money

TrapWhat goes wrongFix
Storing numbers as integersThe leading 0 disappears and 08012345678 becomes 8012345678Store as text, in E.164
Excel exportsLong numbers become 8.01235E+10, and leading zeroes are eatenExport as text, or import the raw CSV
Deduplicating before normalising+2348012345678 and 08012345678 count as two contactsNormalise first, then deduplicate on the E.164 value
Trusting a length check alone11 digits passes for numbers that are not mobiles at allCheck the prefix pattern too
Accepting whatever the user typedInvalid recipients are rejected at send time, after the campaign has startedValidate at the form, and again at import
Assuming a prefix means a networkPorted numbers are misrouted or mis-segmentedDo not segment by prefix

One more habit is worth adopting: normalise on the way in, not on the way out. If every entry point - signup form, CSV import, admin panel, partner API - writes E.164, then everything downstream can assume it. Normalising at send time means every consumer of the data has to remember to do it.

When to reach for a library

For a Nigeria-only product, the regular expression above is sufficient and has no dependency cost. If you also handle other countries, use Google's libphonenumber (or a port of it) rather than accumulating per-country regexes - it tracks numbering plan changes, which a hand-written pattern will not.

Frequently asked questions

What is the country code for Nigeria?
+234. In E.164 a Nigerian mobile number is +234 followed by ten digits, with the local leading 0 removed.
How do I convert 08012345678 to international format?
Drop the leading 0 and prefix +234, giving +2348012345678. Nothing else about the number changes.
Which prefixes are valid Nigerian mobile numbers?
Mobile numbers begin 70, 71, 80, 81, 90 or 91 after the country code, followed by eight more digits. The pattern ^\+?234[789][01]\d{8}$ matches all of them.
Does Sendozi accept numbers in local 0 format?
No. The SMS API accepts +234 or 234 followed by a valid ten-digit mobile number. A local 0-prefixed number is rejected with invalid_recipient, so normalise before sending.
Can I tell which network a Nigerian number belongs to from its prefix?
Not reliably. Number portability means a subscriber keeps their number when they change network, so prefix-based network detection is wrong for ported numbers.

Check it against the API

The SMS reference lists exactly which recipient forms are accepted and which error a bad number returns.