CEP to State (UF) Validator
Validate a Brazilian ZIP code (CEP) and find the matching state (UF) from the official postal ranges. Useful for address forms, sign-ups and shipping.
What a well formed CEP must have
A mistyped CEP in a signup form is the number one source of odd shipping quotes and returned packages. Before calling ViaCEP or the Correios service, you can throw out most of the garbage by looking at the shape alone: digit count, starting range, stray characters in the middle. It is the check you run when the field loses focus, before spending a network request.
Two rules are applied. First, whatever is left after punctuation is removed must be exactly eight digits, so 01310-100 and 01310100 are treated the same. Second, the first five digits, the locality prefix, must be 01000 or higher, because Brazilian numbering starts at 01000-000 in Sao Paulo. And it is worth saying plainly: despite the name, this page does not return the state (UF) and never consults the postal ranges.
So the answer is valid or invalid in form, and nothing beyond that. A well formed CEP can still be fictional: 99999-999 passes the check and matches no address at all. To get street, city and state you need a real lookup against ViaCEP or Correios. Since only eight digits are involved, the whole check happens in your browser and nothing is sent anywhere.
Frequently asked questions
Does this page show the state (UF) for a CEP?
Do I have to type the dash?
Does every eight digit CEP exist?
Related Tools
BR CEP Format Validator
Validate Brazilian CEP format (8 digits, with or without hyphen).
CEP Range Validator
Identify Brazilian region from first 2 digits of CEP code.
Tracking Code Validator
Validate the format of Brazilian Correios tracking codes (AA123456789BR). Identifies the service prefix and the country.
France Postal Validator
Validate the format of a French postal code (5 digits). Useful for forms, e-commerce and international shipping to customers in France.
Japan Postal Validator
Validate the format of a Japanese postal code (〒NNN-NNNN). Useful for forms, e-commerce and international shipping to customers in Japan.
Portugal Postal Code Validator
Validate Portuguese postal codes (####-###) and identify region by first two digits (Lisboa, Porto, Coimbra, etc.).