Brazil CEP Validator

Validate a Brazilian postal code, decode its state and macro-region, and classify the suffix type — all offline.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

The CEP (Código de Endereçamento Postal) is Brazil’s 8-digit postal code, issued and maintained by Correios — the country’s national postal operator. Every address in Brazil has a CEP, from urban apartment blocks in São Paulo to remote villages in the Amazon basin. The code appears on utility bills, bank statements, e-commerce checkouts, government forms, and any application that needs to identify or route mail to a Brazilian address.

Validating a CEP in software is a surprisingly common task: payment gateways require it for address verification, logistics APIs route deliveries using it, and tax systems tie it to fiscal zones. This tool validates the format, decodes the geographic meaning of the 5-digit prefix, and classifies the 3-digit suffix — entirely offline, without querying any external service.

Structure of a CEP

A CEP is always 8 digits, written as NNNNN-NNN:

PartDigitsMeaning
PrefixFirst 5 digitsGeographic range — encodes state and sub-region
SuffixLast 3 digitsAddress type (street, PO box, post office, etc.)

The hyphen is a cosmetic separator only. Internally Correios stores and processes the raw 8-digit string without punctuation.

How the prefix encodes geography

Correios divides Brazil into contiguous numeric blocks, each assigned to a state or metropolitan sub-region. The blocks were allocated roughly from south-east to north, with the most densely populated areas (São Paulo, Rio de Janeiro) getting the widest ranges.

For example:

  • 01000–09999 — São Paulo capital
  • 20000–23799 — Rio de Janeiro capital
  • 70000–73699 — Distrito Federal (Brasília)
  • 90000–99999 — Rio Grande do Sul

Within a state, blocks are further divided by municipality and street segment. A prefix that falls in 80000–87999 is unambiguously in Paraná; one in 50000–56999 is in Pernambuco. The validator decodes this mapping from a static table that covers all 26 states plus the Distrito Federal.

How the suffix encodes address type

The 3 digits after the hyphen tell you what kind of delivery point the CEP represents:

Suffix rangeType
000General area / district — fallback CEP for an entire locality
001–899Street-level CEP — specific street segment or block
900–959PO Box (caixa postal)
960–979Large-volume receiver (empresa de grande porte)
980–999Correios post office

A “street-level” CEP (001–899) is the most common type. A locality CEP (000) is typically used when a village or rural area does not have individual street CEPs — the single 000 code covers the whole settlement.

Worked example

CEP 01310-100 — Avenida Paulista, São Paulo:

  • Prefix: 01310 — falls in the range 01000–09999, which maps to São Paulo capital (SP), macro-region Sudeste.
  • Suffix: 100 — in the 001–899 range, so this is a street-level CEP assigned to a specific segment of Avenida Paulista.
  • Formatted output: 01310-100
  • Verdict: Valid format, prefix in a known Correios range.

A second example: 20040-020 — Avenida Rio Branco, Rio de Janeiro:

  • Prefix: 20040 — range 20000–23799, Rio de Janeiro capital (RJ), Sudeste.
  • Suffix: 020 — street-level address.
  • Verdict: Valid.

An invalid example: 00001-000:

  • Prefix: 00001 — integer value 1, below the minimum assigned prefix of 1000.
  • Verdict: Unassigned — Correios has never allocated this prefix.

What this validator does and does not do

It does: confirm the CEP has exactly 8 digits, that its prefix is not in the permanently unassigned 00000–00999 block, that the prefix matches a published Correios geographic range, and what the suffix type indicates.

It does not: resolve the CEP to a street address, municipality, or neighbourhood — that requires a live API call. For full address resolution, use the open ViaCEP API or the official Correios search portal.

Privacy

The entire validation runs in JavaScript in your browser tab. No CEP or any other data you enter is transmitted, logged, or stored anywhere. The geographic range table is bundled locally — there are no network requests.

Ad placeholder (rectangle)