SkillAgentSearch skills...

Zipcodes.js

Free global postal code validation & lookup for the web. Fast, with no dependencies.

Install / Use

/learn @zipcodes/Zipcodes.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

zipcodes.js

Free postal code validation for the web.

Features

  • Validates against expected regex patterns of the country.
  • Looks up the code via a CDN for accurate validation and geographical data.

Usage

<script src="https://cdn.jsdelivr.net/gh/zipcodes/zipcodes.js@1/zipcodes.min.js"></script>
getZipCode('US', '90210', function (result) {
    console.log(result);
});

Output:

{
    "input":{
        "country": "US",
        "zip": "90210"
    },
    "lookup":{
        "countryCode": "US",
        "postalCode": "90210",
        "placeName": "Beverly Hills",
        "adminName1": "California",
        "adminCode1": "CA",
        "adminName2": "Los Angeles",
        "adminCode2": "037",
        "adminName3": "",
        "adminCode3": "",
        "latitude": "34.0901",
        "longitude": "-118.4065",
        "accuracy": "4"
    },
    "pattern": /^\d{5}(-\d{4})?$/,
    "validPattern": true,
    "validLookup": true,
    "valid": true
}

Supported Countries

Country codes should follow ISO 3166-1 alpha-2

| Flag | Code | Country | Regex | Lookup | | -----------------------------------------------------------------------------|:----:|----------------------------------------------|:-----:|:------:| | <img src="https://flags.zipcodes.gdn/png/256/AD.png" height="12" width="23"> | AD | Andorra | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/AE.png" height="12" width="23"> | AE | United Arab Emirates | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AF.png" height="12" width="23"> | AF | Afghanistan | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AG.png" height="12" width="23"> | AG | Antigua and Barbuda | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AI.png" height="12" width="23"> | AI | Anguilla | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AL.png" height="12" width="23"> | AL | Albania | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AM.png" height="12" width="23"> | AM | Armenia | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AO.png" height="12" width="23"> | AO | Angola | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AQ.png" height="12" width="23"> | AQ | Antarctica | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AR.png" height="12" width="23"> | AR | Argentina | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/AS.png" height="12" width="23"> | AS | American Samoa | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/AT.png" height="12" width="23"> | AT | Austria | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/AU.png" height="12" width="23"> | AU | Australia | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/AW.png" height="12" width="23"> | AW | Aruba | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/AX.png" height="12" width="23"> | AX | sort | ✖ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/AZ.png" height="12" width="23"> | AZ | Azerbaijan | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BA.png" height="12" width="23"> | BA | Bosnia and Herzegovina | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BB.png" height="12" width="23"> | BB | Barbados | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BD.png" height="12" width="23"> | BD | Bangladesh | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BE.png" height="12" width="23"> | BE | Belgium | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BF.png" height="12" width="23"> | BF | Burkina Faso | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BG.png" height="12" width="23"> | BG | Bulgaria | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BH.png" height="12" width="23"> | BH | Bahrain | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BI.png" height="12" width="23"> | BI | Burundi | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BJ.png" height="12" width="23"> | BJ | Benin | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BL.png" height="12" width="23"> | BL | Saint Barthélemy | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BM.png" height="12" width="23"> | BM | Bermuda | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BN.png" height="12" width="23"> | BN | Brunei | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BO.png" height="12" width="23"> | BO | Bolivia | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BQ.png" height="12" width="23"> | BQ | Caribbean Netherlands | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BR.png" height="12" width="23"> | BR | Brazil | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BS.png" height="12" width="23"> | BS | The Bahamas | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BT.png" height="12" width="23"> | BT | Bhutan | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BV.png" height="12" width="23"> | BV | Bouvet Island | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BW.png" height="12" width="23"> | BW | Botswana | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/BY.png" height="12" width="23"> | BY | Belarus | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/BZ.png" height="12" width="23"> | BZ | Belize | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CA.png" height="12" width="23"> | CA | Canada | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/CC.png" height="12" width="23"> | CC | Cocos (Keeling) Islands | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CD.png" height="12" width="23"> | CD | Democratic Republic of the Congo | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CF.png" height="12" width="23"> | CF | Central African Republic | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CG.png" height="12" width="23"> | CG | Republic of the Congo | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CH.png" height="12" width="23"> | CH | Switzerland | ✓ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/CI.png" height="12" width="23"> | CI | Cote d'Ivoire | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CK.png" height="12" width="23"> | CK | Cook Islands | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CL.png" height="12" width="23"> | CL | Chile | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CM.png" height="12" width="23"> | CM | Cameroon | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CN.png" height="12" width="23"> | CN | China | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CO.png" height="12" width="23"> | CO | Colombia | ✖ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/CR.png" height="12" width="23"> | CR | Costa Rica | ✖ | ✓ | | <img src="https://flags.zipcodes.gdn/png/256/CU.png" height="12" width="23"> | CU | Cuba | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CV.png" height="12" width="23"> | CV | Cabo Verde | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CW.png" height="12" width="23"> | CW | Curaçao | ✖ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CX.png" height="12" width="23"> | CX | Christmas Island | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CY.png" height="12" width="23"> | CY | Cyprus | ✓ | ✖ | | <img src="https://flags.zipcodes.gdn/png/256/CZ.png" height="12" width="23"> | CZ | Czechia | ✓

View on GitHub
GitHub Stars85
CategoryDevelopment
Updated1mo ago
Forks14

Languages

PHP

Security Score

100/100

Audited on Feb 23, 2026

No findings