Skip to content

Detecting government email domains in every country

· 6 min read · Business email

There is no single government email domain. Detection works in two layers: a pattern rule that catches the common structures (.gov and .mil in the US, and gov.<cc>, gouv.<cc>, gob.<cc> or govt.<cc> elsewhere, such as gov.uk, gouv.fr, gob.mx and govt.nz), plus an explicit list for countries that use something else entirely, like Canada (gc.ca), Germany (bund.de), Japan (go.jp, lg.jp) and the EU institutions (europa.eu). The pattern rule alone gets you a long way, and it is wrong in predictable places.

Here's how each layer works, the country-specific exceptions, and code that handles both.

Why you'd want to detect government addresses

The usual reasons, roughly in order of how much they need to be right:

  • Routing. Public-sector leads often go to a dedicated team because procurement works differently.
  • Pricing and eligibility. Government or public-sector discounts, or a free tier for public bodies.
  • Verified badges. Marking an account as an official agency account, which is a trust decision and needs the strictest check.
  • Not enriching them. A government domain isn't a startup with a funding stage, and treating it as a "company" fills your CRM with nonsense firmographics.

The first and last are fine with a pattern rule. The third needs a confirmation code and probably a human.

Layer 1: The pattern rule

Most countries put government bodies under a registry-controlled second-level domain. The common labels:

Pattern Examples Used by
.gov (TLD) irs.gov, nasa.gov, ny.gov United States
.mil (TLD) army.mil, navy.mil US military
gov.<cc> gov.uk, gov.au, gov.in, gov.br, gov.sg, gov.cn Many countries
gouv.<cc> gouv.fr, gouv.ci Several French-speaking countries
gob.<cc> gob.mx, gob.es, gob.ar Spanish-speaking governments
govt.<cc> govt.nz New Zealand

The US .gov TLD is the most tightly controlled of these. Per get.gov's eligibility page, "Only verified U.S. government organizations can register and operate a .gov domain", the registry is run by CISA, and each request needs sign-off from a senior official in the organization. That makes a confirmed .gov address one of the stronger affiliation signals you can get from email alone.

Two implementation details:

  1. Match on the full hostname, not the registrable domain. Many gov.<cc> zones are public suffixes, so for jane@digital.cabinet-office.gov.uk the registrable domain is cabinet-office.gov.uk. That's fine. But your rule must look at the labels next to the TLD, wherever the host ends.
  2. Require at least three labels for second-level patterns. gov.uk by itself isn't a mailbox domain for anyone; something.gov.uk is.

Layer 2: Countries the pattern rule misses

These are the cases a gov/gouv/gob rule silently classifies as ordinary companies.

Canada. Federal departments use gc.ca subdomains, and current Government of Canada email configuration requirements say each account has an address on the department's primary domain (name@department.gc.ca) and one on @canada.ca. Neither matches gov.<cc>. Note that gc.ca is itself on the Public Suffix List, so each department is its own registrable domain; match it as a suffix.

Germany. Federal ministries and agencies use subdomains of bund.de (the Federal Environment Ministry, for example, publishes its contact mailbox on a bund.de subdomain). States use their own domains.

Japan. The registry JPRS reserves go.jp for "Japanese government authorities", government research institutes and government-affiliated corporations, and lg.jp for "Japanese local authorities". Neither label is gov.

South Korea uses go.kr for government bodies, the same structure as Japan.

The European Union. EU institutions use europa.eu subdomains (ec.europa.eu for the Commission).

The UK, beyond gov.uk. gov.uk covers central government and many councils, but public bodies also use police.uk, nhs.uk and nhs.net (NHSmail), mod.uk and parliament.uk. Whether the NHS counts as "government" for your purposes is a product decision, not a technical one.

India. Alongside gov.in, some government email is hosted on nic.in, the domain of the National Informatics Centre.

US local government. .gov is open to cities, counties and school districts, but many still use .us locality domains, .org or .com. No rule catches those. A city clerk at a .org address looks exactly like a non-profit.

Layer 3: Things that look like government and aren't

The pattern rule has one structural weakness: it checks labels, not registries. In most countries gov.<cc> is a restricted zone, but the rule can't tell that from text. If someone registers a domain literally called gov under an open TLD, then agent@agency.gov.xyz has gov as its second-to-last label and passes. The same applies to gob and gouv.

If you're granting something valuable, such as a verified badge or free paid features, replace "any gov.<cc>" with an explicit list of the government suffixes you've checked, one country at a time. For routing and analytics the loose rule is fine.

Also watch for international organizations. un.org, who.int and other .int domains belong to intergovernmental bodies. They're not national governments, and most pattern rules ignore them. Decide whether they belong in your "government" bucket.

Code: pattern rule plus explicit suffixes

const GOV_TLDS = new Set(['gov', 'mil']);
const GOV_SLDS = new Set(['gov', 'gouv', 'gob', 'govt']);

// Government (or public-sector) suffixes that don't follow the pattern.
// Matched against the end of the hostname. Extend for your markets.
const GOV_SUFFIXES = [
  'gc.ca', 'canada.ca',      // Canada (federal)
  'bund.de',                 // Germany (federal)
  'go.jp', 'lg.jp',          // Japan (national, local)
  'go.kr',                   // South Korea
  'europa.eu',               // EU institutions
  'nic.in',                  // India (NIC-hosted government mail)
  'police.uk', 'mod.uk', 'parliament.uk',
  // 'nhs.uk', 'nhs.net',    // public sector; include if your policy says so
];

export function governmentMatch(email) {
  const host = email.slice(email.lastIndexOf('@') + 1).trim().toLowerCase();
  const labels = host.split('.');
  if (labels.length < 2) return null;

  const tld = labels.at(-1);
  const sld = labels.at(-2);

  if (GOV_TLDS.has(tld)) return { rule: 'tld', suffix: tld };
  if (labels.length >= 3 && GOV_SLDS.has(sld)) {
    return { rule: 'pattern', suffix: `${sld}.${tld}` };
  }
  for (const suffix of GOV_SUFFIXES) {
    if (host === suffix || host.endsWith(`.${suffix}`)) {
      return { rule: 'explicit', suffix };
    }
  }
  return null;
}

governmentMatch('a@digital.cabinet-office.gov.uk'); // { rule: 'pattern', suffix: 'gov.uk' }
governmentMatch('a@tbs-sct.gc.ca');                 // { rule: 'explicit', suffix: 'gc.ca' }
governmentMatch('a@city-of-springfield.org');       // null

Return the rule that matched, not just a boolean. tld (a US .gov or .mil) and explicit matches are stronger than pattern matches, and you may want to treat them differently when the stakes are high.

What pingutil does

pingutil implements Layer 1: .gov and .mil TLDs, plus gov, gouv, gob and govt as the second-to-last label of the full hostname (with at least three labels), so jane@cs.agency.gov.au is caught even though the registrable domain is agency.gov.au. It runs after the disposable and free-webmail lists and before the educational and company checks, and returns category: "government" with company: null, so no enrichment is attempted.

It does not include the Layer 2 suffixes, so gc.ca, bund.de, go.jp and europa.eu addresses come back as company (and a full lookup without skip_enrichment would enrich them like a business). Combine it with the explicit list:

const res = await fetch('https://pingutil.com/v1/lookup', {
  method: 'POST',
  headers: {
    authorization: `Bearer ${process.env.PINGUTIL_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({ input: email, skip_enrichment: true }),
});
const data = await res.json();

const local = governmentMatch(email);
const isGovernment = data.category === 'government' || local?.rule === 'explicit';

You can check how a given address is classified in the live demo, browse the government category, or read the field reference in the API docs. The educational side uses the same kind of rule and has the same blind spots (ethz.ch is a university, nothing in the domain says so); verifying student email addresses covers it.

Before you ship

  • Match patterns on the full hostname and require three labels for gov.<cc>-style rules.
  • Add explicit suffixes for every country you actually serve: Canada, Germany, Japan, Korea and the EU are the usual gaps.
  • Decide up front whether NHS, police, intergovernmental and municipal .org domains count.
  • Use the loose rule for routing; use an explicit suffix list plus a confirmation code for badges and discounts.
  • Keep government domains out of company enrichment and out of company-size lead routing, where a large ministry will be mistaken for an enterprise prospect.

Questions people ask

Can anyone register a .gov domain?
No. The .gov top-level domain is managed by CISA and limited to verified US government organizations: federal, state, territorial, tribal, county, city, special district, school district and interstate bodies. A request also has to be approved by a senior official in the organization.
Is every government email address on a gov domain?
No. Canada's federal government uses gc.ca and canada.ca, Germany's federal administration uses bund.de, Japan uses go.jp for national agencies and lg.jp for local authorities, and many US local governments still use .us, .org or .com domains.
Does a government email domain prove someone works for the government?
It shows the address was issued by that organization's mail system, and a confirmation code shows the person controls it. Contractors are sometimes given government addresses too, so treat it as strong evidence of affiliation, not of employment status.