
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
countries-states-cities
Advanced tools
Countries, states/regions, cities.
Data from: https://github.com/dr5hn/countries-states-cities-database
npm i countries-states-cities
OR
yarn add countries-states-cities
ES6 Module usage
import csc from 'countries-states-cities'
AMD Module usage
let csc = require('countries-states-cities')
It accepts a valid CountryCode eg: 'AS' and returns Country Details
type: json | ICountry
{
"id": 233,
"name": "United States",
"iso3": "USA",
"iso2": "US",
"phone_code": "1",
"capital": "Washington",
"currency": "USD",
"native": "United States",
"region": "Americas",
"subregion": "Northern America",
"timezones": [
{
"zoneName": "America\/Adak",
"gmtOffset": -36000,
"gmtOffsetName": "UTC-10:00",
"abbreviation": "HST",
"tzName": "Hawaii–Aleutian Standard Time"
},
{
"zoneName": "America\/Anchorage",
"gmtOffset": -32400,
"gmtOffsetName": "UTC-09:00",
"abbreviation": "AKST",
"tzName": "Alaska Standard Time"
},
],
"emoji": "🇺🇸",
"emojiU": "U+1F1FA U+1F1F8"
}
It accepts a valid CountryId and returns Country Details
type: json | ICountry
{
"id": 31,
"name": "Brazil",
"iso3": "BRA",
"iso2": "BR",
"phone_code": "55",
"capital": "Brasilia",
"currency": "BRL",
"native": "Brasil",
"region": "Americas",
"subregion": "South America",
"timezones": [
{
"zoneName": "America\/Araguaina",
"gmtOffset": -10800,
"gmtOffsetName": "UTC-03:00",
"abbreviation": "BRT",
"tzName": "Brasília Time"
},
{
"zoneName": "America\/Bahia",
"gmtOffset": -10800,
"gmtOffsetName": "UTC-03:00",
"abbreviation": "BRT",
"tzName": "Brasília Time"
},
],
"emoji": "🇧🇷",
"emojiU": "U+1F1E7 U+1F1F7"
}
It accepts a valid StateId and returns State Details
type: json | IState
{
"id": 1997,
"name": "Rio de Janeiro",
"country_id": 31,
"country_code": "BR",
"state_code": "RJ"
}
It accepts a valid CityId and returns City Details
type: json | ICity
{
"id": 16796,
"name": "Paris",
"state_id": 866,
"state_code": "ON",
"country_id": 39,
"country_code": "CA",
"latitude": "43.20000000",
"longitude": "-80.38333000"
}
It accepts a valid CountryId and returns all States as Array of JSON
type: array of json | IState
[
{
"id": 1462,
"name": "Washington",
"country_id": 233,
"country_code": "US",
"state_code": "WA"
}
]
It accepts a valid CityId and returns all Cities as Array of JSON
type: array of json | ICity
[
{
"id": 7052,
"name": "Roma",
"state_id": 3905,
"state_code": "QLD",
"country_id": 14,
"country_code": "AU",
"latitude": "-26.56741000",
"longitude": "148.78751000"
}
]
It returns all Countries
type: array of json | ICountry
[
{
"id": 39,
"name": "Canada",
"iso3": "CAN",
"iso2": "CA",
"phone_code": "1",
"capital": "Ottawa",
"currency": "CAD",
"native": "Canada",
"region": "Americas",
"subregion": "Northern America",
"emoji": "🇨🇦",
"emojiU": "U+1F1E8 U+1F1E6"
}
]
Total Countries: 250
Total States/Regions/Municipalities: 4,874
Total Cities/Towns/Districts: 146,156
Last Updated On: 22nd December 2020
FAQs
Countries, states/regions, cities.
The npm package countries-states-cities receives a total of 723 weekly downloads. As such, countries-states-cities popularity was classified as not popular.
We found that countries-states-cities demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.