1001Ferramentas
📮Validators

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?
No. Despite the name, it only checks the format: eight digits with a prefix of 01000 or higher. To get the state you need an actual postal lookup such as ViaCEP or Correios.
Do I have to type the dash?
No. Anything that is not a digit is discarded before counting, letters included. That means a field with junk glued to it can still pass, so read what you typed before trusting a positive result.
Does every eight digit CEP exist?
No. A correct format does not mean an assigned range. Codes such as 99999-999 are well formed and match no real address.

Related Tools