Free freight tool
UN/LOCODE Port Code Lookup
Search the bundled UNECE UN/LOCODE data by port name or five-character code. Use standardized location codes to reduce ambiguity in shipping documents and route records.
Recommended next step
Use the verified UN/LOCODE in carrier shipping instructions.
Short answer
What a UN/LOCODE is
A UN/LOCODE is a five-character code that identifies a trade and transport location: two letters for the country under ISO 3166-1, then three characters for the place. The current UNECE list includes CNSGH for Shanghai and the port-specific CNSHG entry; CNSHA identifies Shanghai Hongqiao International Airport. Rotterdam is NLRTM and Los Angeles is USLAX. The code list is maintained by the United Nations Economic Commission for Europe.
- Characters 1–2: ISO country code
- Characters 3–5: location, using A–Z and 2–9
- Digits 0 and 1 are never used
- One location can carry several transport functions
Find a Port Code by Name or UN/LOCODE
- Find a port by name
- Confirm a five-character UN/LOCODE
- Standardize routing references
- Reduce ambiguous port naming
UN/LOCODE Search Method and Limits
Search terms are matched against the bundled UN/LOCODE location name and code data, including the two-character country prefix and three-character location identifier.
Confirm terminal, facility and carrier routing details separately; a UN/LOCODE identifies a trade and transport location, not every terminal within it.
How a UN/LOCODE is built
The structure is deliberately restrictive so that codes stay unambiguous when they are handwritten, faxed, scanned or read aloud over a phone. The first two characters are the ISO 3166-1 alpha-2 country code — CN for China, NL for the Netherlands, US for the United States. The remaining three identify the location within that country.
Those three characters may be letters A to Z or the digits 2 to 9. Zero and one are excluded because they are too easily confused with the letters O and I in printed and scanned documents. That single design decision prevents an entire category of transcription error, and it is why you will never see a UN/LOCODE containing a 0 or a 1.
| Code | Country | Location | Notes |
|---|---|---|---|
| CNSGH | CN — China | Shanghai | Current Shanghai location with port function; the list also contains the port-specific CNSHG entry |
| SGSIN | SG — Singapore | Singapore | Country and city coincide, so the code looks redundant but follows the same rule |
| NLRTM | NL — Netherlands | Rotterdam | Europe's largest container port |
| USLAX | US — United States | Los Angeles | The three-character part matches the IATA airport code here by coincidence, not by rule |
| AEJEA | AE — United Arab Emirates | Jebel Ali | The port, distinct from AEDXB for Dubai |
| DEHAM | DE — Germany | Hamburg | Covers the port; individual terminals have no separate UN/LOCODE |
| INNSA | IN — India | Jawaharlal Nehru (Nhava Sheva) | Distinct from INBOM for Mumbai, though the two are frequently interchanged in error |
The function classifier: why not every code is a seaport
UN/LOCODE covers trade and transport locations generally, not seaports specifically. Each entry carries an eight-position function classifier that says what the location actually does. This matters in practice: a code that identifies an inland rail terminal is a perfectly valid UN/LOCODE and a completely wrong port of loading.
Positions are read independently, and a location can have several. A major coastal city will typically show a port function, an airport function and a road terminal function at once.
| Position | Meaning |
|---|---|
| 0 | Function not known — to be specified |
| 1 | Maritime port, any size |
| 2 | Rail terminal |
| 3 | Road terminal |
| 4 | Airport |
| 5 | Postal exchange office |
| 6 | Multimodal function, inland clearance depot |
| 7 | Fixed transport function, such as an oil platform |
| B | Border crossing |
A UN/LOCODE is not a terminal code
DEHAM identifies Hamburg, not Burchardkai, Altenwerder or Tollerort. Terminal identification is handled by carrier and port-community systems, and the terminal is normally named separately on the booking confirmation and arrival notice. If a routing dispute turns on which terminal cargo went to, the UN/LOCODE will not settle it.
Where port codes appear on shipping documents
Once you know where to look, UN/LOCODEs turn up throughout the document set, and cross-checking them is one of the fastest structural checks available on a shipment file. A route that changes between the booking confirmation and the Bill of Lading, without anybody having agreed a change, is worth a phone call.
- Bill of Lading: place of receipt, port of loading, port of discharge and place of delivery
- Booking confirmation: the same four routing points, plus the transhipment port where applicable
- Arrival notice: port of discharge and the final place of delivery
- Commercial invoice and packing list: often shown alongside the named ports as supporting reference
- Customs declarations: many national systems require the UN/LOCODE rather than a place name
- Certificates of origin and letters of credit: the named port must agree with the transport document
Codes that are routinely confused
Most port-code errors are not exotic. They come from a small set of genuinely confusable pairs, from cities with more than one port, and from countries where several places share a name. Checking the code rather than the name catches all three.
Cities with more than one port
The city name on a purchase order rarely identifies the port precisely enough for a booking. Getting this wrong means the cargo arrives at the wrong terminal, in the wrong port authority's jurisdiction, and sometimes several hundred kilometres from the consignee.
- Mumbai: INBOM for the city port and INNSA for Jawaharlal Nehru Port at Nhava Sheva, which handles the container volume
- Dubai: AEDXB for Dubai and AEJEA for Jebel Ali, where nearly all container traffic moves
- Shanghai: use the current UNECE entry required by the counterparty or filing system—CNSGH is the Shanghai location with port function and CNSHG is the port-specific entry; CNSHA is Hongqiao airport
- New York and New Jersey: USNYC covers the port district that spans both states
- Ho Chi Minh City: VNSGN, still coded from the former name Saigon
Legacy and superseded codes
UN/LOCODE is revised twice a year. Codes are added, and occasionally a location is renamed or a code is retired. Older codes persist for years in carrier systems, customer master data and printed forms, which is why a document can carry a code that no current list contains.
A superseded code is not necessarily an error in the document — it may simply be old master data. Treat an unrecognised code as something to verify, not something to reject: the practical response is to warn and ask, not to fail the shipment.
UN/LOCODE against the other codes on your documents
Shipping paperwork is dense with short alphanumeric codes, and they are not interchangeable. Confusing them produces filings that are syntactically valid and factually wrong — the hardest kind of error to find.
| Code type | Format | Identifies | Issued by |
|---|---|---|---|
| UN/LOCODE | 5 characters, e.g. NLRTM | A trade and transport location | UNECE |
| IATA airport code | 3 letters, e.g. AMS | An airport | IATA |
| ICAO airport code | 4 letters, e.g. EHAM | An airport or aerodrome | ICAO |
| SCAC | 2–4 letters, e.g. MAEU | An ocean or land carrier | NMFTA |
| IMO number | 7 digits | A specific vessel, for its whole life | IMO via IHS Markit |
| ISO 6346 owner code | 3 letters + U/J/Z | A container owner or operator | BIC |
| HS code | 6+ digits | A commodity for tariff purposes | WCO and national authorities |
Using the lookup in a document review
- 1Search by port name when you have a place and need the code, or by code when you have a document and need to confirm what it means.
- 2Check the country prefix first — a code whose first two letters do not match the country you expect is the most common error and the easiest to spot.
- 3Confirm the location is the one you mean when a city has more than one port; search the port name rather than the city name where they differ.
- 4Cross-check the same routing point across the booking confirmation, Bill of Lading and arrival notice; all three should agree.
- 5Record the code, not only the port name, in your own systems so that downstream filings and EDI messages have an unambiguous reference.
Dataset misses are warnings, not failures
A bundled dataset is a snapshot. When a code is not found, the correct operational response is a warning that asks a human to verify — never an automatic rejection. Legitimate legacy codes, recently added locations and locations coded under a former name all fail a naive lookup while being entirely correct on the document.
Port Code Lookup FAQ
Practical answers to the questions operators, forwarders and shippers ask most often about un/locode port lookup results.
What does UN/LOCODE stand for?
United Nations Code for Trade and Transport Locations. It is maintained by the United Nations Economic Commission for Europe (UNECE) and is published as a public dataset covering well over 100,000 locations worldwide, revised twice a year.
What is the UN/LOCODE format?
Five characters with no separator in electronic data, though it is often printed with a space: two letters for the country from ISO 3166-1 alpha-2, then three characters identifying the location. The location part uses letters A–Z and digits 2–9 only — 0 and 1 are excluded because they are too easily confused with O and I.
Which current UN/LOCODE should I use for Shanghai port?
Check the current UNECE directory and the code required by the carrier or filing system. The current list contains CNSGH for Shanghai with a port function and CNSHG for Shanghai Port; CNSHA is Shanghai Hongqiao International Airport. Never derive or silently substitute a code from the city name alone.
Is a UN/LOCODE the same as a port code used by a carrier?
Not always. Carriers, port-community systems and customs authorities sometimes maintain their own location identifiers, and a few national systems use codes that resemble UN/LOCODEs without matching them. The UN/LOCODE is the interoperable standard and the one you should carry between systems, but confirm which reference a specific filing actually requires.
Does a UN/LOCODE identify a specific terminal or berth?
No. It identifies a location — a port, city or transport node. Individual terminals, berths and depots within that location have no separate UN/LOCODE. Terminal identification comes from the carrier's booking confirmation, the arrival notice or the local port-community system.
Can one place have more than one UN/LOCODE?
A location has one code, but a metropolitan area can contain several separately coded locations — Dubai and Jebel Ali, or Mumbai and Nhava Sheva, are the classic examples. Conversely a single code can carry several transport functions at once, which is what the eight-position function classifier records.
How often is the UN/LOCODE list updated?
UNECE publishes revisions twice a year. Additions are common; retirements and renames are rarer but do happen. Because carrier systems, customer master data and printed forms lag behind, expect to encounter valid-looking codes that a current dataset does not contain.
What should I do if a code on a document is not in the dataset?
Treat it as a question, not an error. Search for the port by name to see whether a different code is now current, check whether the location was renamed, and confirm with the carrier or the document issuer. Do not overwrite a code on an issued transport document — if it is genuinely wrong, it needs an authorised amendment from the party that issued the document.
Are airport codes and port codes the same thing?
No. Airports use three-letter IATA codes and four-letter ICAO codes; ports use five-character UN/LOCODEs. The coincidence that USLAX contains LAX is exactly that — a coincidence. Many UN/LOCODEs do not match the local airport code at all, and using an IATA code where a UN/LOCODE is required will fail validation in most customs systems.
Do I need the port code or is the port name enough?
The name is enough for a conversation and insufficient for a system. Place names are duplicated across and within countries, transliterated inconsistently, and printed with and without diacritics. Recording the code alongside the name removes that ambiguity permanently and is what makes automated matching between documents possible.
Does GainingDocx validate port codes inside my documents?
Yes. When a Bill of Lading, sea waybill, booking confirmation or arrival notice is extracted, the routing points are matched against the bundled UN/LOCODE dataset. A recognised code is confirmed, an unrecognised one raises a warning for review, and a code whose country prefix disagrees with the named port is highlighted as a likely error.
Where does the underlying data come from?
The bundled dataset is derived from the UNECE UN/LOCODE publication, which is the authoritative public source. It is a point-in-time snapshot rather than a live query, so for a filing that turns on a very recently assigned code, confirm against the current UNECE publication.
Related tools, templates and guides
- Bill of Lading parserExtract routing points from a B/L and match them against the UN/LOCODE dataset automatically.
- How to read a Bill of LadingWhat each routing field means and how the four place fields differ.
- Container number checkValidate the equipment references that travel with the routing on your B/L.
- Standards and datasets usedWhich reference data GainingDocx bundles, and how current each snapshot is.