Costa Rica postal codes (ZIP codes)

Find the postal code of any district by name or number. Official IGN data for all 7 provinces, 84 cantons and 494 districts.

Type a district or canton name, or a 5-digit postal code.

Find by province, canton and district

Provinces and cantons of Costa Rica

Choose a province or canton to see the postal codes of all its districts.

See all 84 cantonsSee all 494 districts

Districts inside and outside the GAM

All 494 districts with their postal code and zone, based on the Greater Metropolitan Area defined by the 2013-2030 GAM Plan. Filter by zone or search by name or code.

Zone

Postal codeDistrictCantonProvinceZone

How Costa Rica postal codes work

Costa Rica does not have a single ZIP code: every district has its own 5-digit postal code. It is the district's official code: P (province, 1 digit) + CC (canton, 2 digits) + DD (district, 2 digits). For example, San Antonio in Desamparados is 1 03 05 = 10305.

Each province's codes start with its number: 1 San José, 2 Alajuela, 3 Cartago, 4 Heredia, 5 Guanacaste, 6 Puntarenas and 7 Limón. When a district moves to another canton, its old code is retired and never reused, so numbering can have gaps (for example, Grecia has no district 6).

Frequently asked questions

What is the ZIP code of Costa Rica?

There isn't just one: each of the 494 districts has its own 5-digit postal code. For example, downtown San José (Carmen district) is 10101, downtown Alajuela is 20101, Cartago (Oriental) is 30101 and downtown Heredia is 40101. Use the search box above to find yours.

What do I enter as "ZIP code" when shopping online?

Your district's 5-digit postal code. International forms call it "ZIP code" or "postal code"; in Costa Rica it is the same number.

How many provinces, cantons and districts does Costa Rica have?

According to the IGN's 2026 Administrative Territorial Division, Costa Rica has 7 provinces, 84 cantons and 494 districts. The newest cantons are Monteverde and Puerto Jiménez, in Puntarenas. The newest districts are Pijije (Bagaces) and Cabagra (Buenos Aires), created by law in May 2025.

Which postal codes are in the GAM?

Currently 167 districts are inside the Greater Metropolitan Area (GAM) and 327 are outside; see the district list. It follows the official 2013-2030 GAM Plan by MIVAH. When the official boundary splits a district, it counts as GAM if at least half of its buildings are inside. Some shipping companies use their own list; for example, Grecia is not GAM under the official definition.

Where does the data come from?

From the 2026 Administrative Territorial Division (DTA 2026) published by the National Geographic Institute (IGN), the official division into provinces, cantons and districts. The postal code is each district's official code.

Free postal code API for developers

All of this data is available as a free JSON API: static files, open CORS and no API key. Names and field names are in Spanish, as published by the IGN.

7provinces
84cantons
494districts

Source: Administrative Territorial Division (DTA 2026), National Geographic Institute of Costa Rica (IGN).

API endpoints

All endpoints answer GET with JSON. Canton and district numbers have no leading zeros.

PathReturns
/provincias.jsonThe 7 provinces
/provincia/{p}/cantones.jsonCantons of a province
/provincia/{p}/canton/{c}/distritos.jsonDistricts of a canton
/codigo-postal/{PCCDD}.jsonA district by postal code, with its canton and province
/distritos.jsonFlat list of every district with its postal code
/gam.jsonPostal codes inside and outside the Greater Metropolitan Area (GAM), for shipping rates
/todo.jsonFull tree with official codes and areas in km²
/meta.jsonAPI version, source, edition and totals
/openapi.jsonOpenAPI 3.1 specification
/llms.txtUsage guide for AI agents (in Spanish)

Usage examples

// Cantons of San José
const cantons = await fetch('/provincia/1/cantones.json').then(r => r.json());
// { "1": "San José", "2": "Escazú", "3": "Desamparados", ... }

// District from a postal code
const d = await fetch('/codigo-postal/10305.json').then(r => r.json());
// { "codigo_postal": "10305", "distrito": "San Antonio", "canton": "Desamparados",
//   "provincia": "San José", "codigos": { "provincia": 1, "canton": 3, "distrito": 5 },
//   "gam": true, ... }

API questions

Is the API free? Do I need an API key?

It is free and needs no API key or sign-up. CORS is open, so you can call it directly from a browser, a mobile app or a server.

How often is the data updated?

Whenever the National Geographic Institute publishes a new edition of the Administrative Territorial Division, every two years, or when a law creates a new canton or district. /meta.json shows the current edition.

Why are the names in Spanish?

Province, canton and district names are proper nouns and are kept exactly as the IGN publishes them. JSON field names are also in Spanish (provincia, canton, distrito, codigo_postal) so the API stays compatible with existing integrations.