# Isin compute from nsin

`isin-compute-from-nsin` · version 1.0.0 · Identifiers & check digits · free, no key needed

Build a 12-character ISIN from a country prefix and a CUSIP/SEDOL national number, computing its Luhn check digit.

**Use when you need to: convert cusip to isin · convert sedol to isin · build an isin from a national security number.**

## Decide before calling

Read the [versioned contract](/v1/tools/isin-compute-from-nsin/versions/1.0.0) and the supported scope below. Reuse `isin-compute-from-nsin@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `isin-compute-from-nsin@1.0.0` for convert cusip to isin. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- convert cusip to isin
- convert sedol to isin
- build an isin from a national security number
- compute isin check digit from cusip
- turn a uk sedol into an isin
- generate isin from nsin
- pad a sedol into an isin nsin slot

## Not supported

- validating an already-complete 12-character ISIN (see isin-validate)
- computing an ISIN for a country outside US, CA, GB, IE, IM, JE, GG
- computing the CUSIP or SEDOL check digit for the caller (the national number must already be self-consistent)

## Behavior

- nsin_padded is nsin left-padded with '0' to exactly 9 characters (a no-op when nsin is already 9 characters); this covers both a 9-character CUSIP unchanged and a 7-character SEDOL gaining exactly two leading zeros.
- Only country_prefix values US, CA, GB, IE, IM, JE, GG are supported; any other well-formed 2-letter value throws unsupported_input.
- For US/CA, nsin_padded must be a self-consistent CUSIP that is ISIN-eligible: its first 8 characters must each be a digit 0-9 or an uppercase letter A-Z (the CUSIP private-placement characters '*', '@' and '#' are valid in a CUSIP but never in an ISIN NSIN) and its own 9th character must equal the ANSI X9.6 check digit computed from those 8 characters; a charset violation throws invalid_input with details.reason 'cusip_invalid_character', a check-digit mismatch throws invalid_input with details.reason 'cusip_check_digit_mismatch'.
- For GB/IE/IM/JE/GG, nsin_padded's first two characters must be '00' and the remaining 7 characters must be a self-consistent SEDOL (weights 1,3,1,7,3,9 over the first 6, no vowels); a padding, charset or check-digit failure throws invalid_input.
- Once nsin_padded is accepted, check_digit is computed exactly as in isin-validate: expand country_prefix+nsin_padded (11 characters, A=10 ... Z=35) then apply Luhn (double every digit at an odd 1-based position from the right, sum, check = (10 - sum mod 10) mod 10).
- isin is country_prefix + nsin_padded + check_digit (12 characters, no case folding).

## Input

- `country_prefix` (string, required): min length 2; max length 2; pattern `^[A-Z]{2}$`
- `nsin` (string, required): min length 1; max length 9

## Output

- `isin` (string, required): min length 12; max length 12
- `check_digit` (string, required): min length 1; max length 1
- `nsin_padded` (string, required): min length 9; max length 9
- `data_version` (string, required)

## Limits

- max country prefix bytes: 2
- max nsin bytes: 9

## Example

Request input:

```json
{
  "country_prefix": "US",
  "nsin": "037833100"
}
```

Response:

```json
{
  "result": {
    "isin": "US0378331005",
    "check_digit": "5",
    "nsin_padded": "037833100",
    "data_version": "isin-nsin-schemes-2026-09-28"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "isin-compute-from-nsin",
  "version": "1.0.0",
  "input": {
    "country_prefix": "US",
    "nsin": "037833100"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/isin-compute-from-nsin/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"country_prefix":"US","nsin":"037833100"}'
```

The machine-readable contract is at [/v1/tools/isin-compute-from-nsin/versions/1.0.0](/v1/tools/isin-compute-from-nsin/versions/1.0.0).

### CLI

```sh
node cli.mjs run isin-compute-from-nsin 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Iban compute from bban](/tools/iban-compute-from-bban): Compute the MOD 97-10 check digits and full IBAN for a country code and BBAN, using the pinned IBAN registry.
- [Isin validate](/tools/isin-validate): Validate a 12-character ISIN's ISO 6166 Luhn check digit and parse its country prefix, NSIN and NSIN scheme.
- [Rf creditor reference compute](/tools/rf-creditor-reference-compute): Compute the MOD 97-10 check digits and full ISO 11649 RF Creditor Reference for a base reference (invoice number).
- [Issn validate](/tools/issn-validate): Validate an 8-digit ISSN's mod 11 check digit (X allowed) and compute its 977-prefixed EAN-13 barcode form.
- [Cn resident id parse](/tools/cn-resident-id-parse): Parse an 18-digit (or legacy 15-digit) Chinese resident ID: region code, birth date, sex and GB 11643-1999 check digit.
- [Ismn validate](/tools/ismn-validate): Validate an ISMN's EAN mod 10 check digit in M-form or 979-0 form and return the canonical 13-digit form.
