# country-code-lookup

> Finds countries by various country codes

Latest version **0.2.1** (published 2026-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install country-code-lookup
pnpm add country-code-lookup
yarn add country-code-lookup
bun add country-code-lookup
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2026-10-13 |
| First published | 2014-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/country-code-lookup) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 64.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 86 |
| Author | Richard Astbury |
| Maintainers | richard.astbury |
| Keywords | fips, iso, country, code, countries |

## Links

- npm: https://www.npmjs.com/package/country-code-lookup
- Repository: https://github.com/richorama/country-code-lookup
- Issues: https://github.com/richorama/country-code-lookup/issues
- npm.io page: https://npm.io/package/country-code-lookup

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2026-10-13
- 0.2.0 — 2026-10-13
- 0.1.5 — 2026-03-25
- 0.1.4 — 2026-03-25
- 0.1.3 — 2024-04-30
- 0.1.2 — 2024-03-04
- 0.1.1 — 2024-01-02
- 0.1.0 — 2023-06-14
- 0.0.23 — 2023-04-04
- 0.0.22 — 2022-12-01
- 0.0.20 — 2021-12-01
- 0.0.19 — 2021-02-17
- 0.0.18 — 2020-09-26
- 0.0.17 — 2020-03-23
- 0.0.16 — 2020-02-03
- … 16 more at https://npm.io/package/country-code-lookup/versions

## README

[![NPM version](https://img.shields.io/npm/v/country-code-lookup.svg)](https://www.npmjs.com/package/country-code-lookup)
![](https://github.com/richorama/country-code-lookup/workflows/Node%20CI/badge.svg?branch=master) 
[![Downloads](https://img.shields.io/npm/dm/country-code-lookup.svg)](https://npmcharts.com/compare/country-code-lookup?minimal=true)

# Country Code Lookup

A node.js module to look up countries by various country codes.

Supported codes:

* FIPS 10-4 codes (2 digits)
* ISO 3166 (2 digits)
* ISO 3166 (3 digits)
* ISO 3166 (numbers)
* Internet codes

## Installation

```
$ npm install country-code-lookup
```

## Usage

```js
const lookup = require('country-code-lookup')

// search by FIPS
lookup.byFips('UK')

// search by ISO
lookup.byIso('GB')
lookup.byIso('GBR')
lookup.byIso(826)

// search by internet code
lookup.byInternet('UK')

// search by country name
lookup.byCountry('United Kingdom')

// get an array of all countries
lookup.countries
```

Searching for a country will return either null, or a country object:

```js
{ continent: 'Europe',
  region: 'Western Europe',
  country: 'United Kingdom',
  capital: 'London',
  fips: 'UK',
  iso2: 'GB',
  iso3: 'GBR',
  isoNo: '826',
  internet: 'UK' }
````

## Useful Links

ISO 2 and 3 digit country codes: https://www.iban.com/country-codes

## License

MIT

---
_Source: https://npm.io/package/country-code-lookup · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
