Card number (Luhn) and IBAN validator

Check a card number with the Luhn checksum and name its network, or check an IBAN by length and mod-97.

Input

The card number or IBAN. Spaces and hyphens are ignored.
What the value is. "auto" decides from its first characters.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/luhn-iban-validate \
  -H 'Content-Type: application/json' \
  -d '{"input":{"value":"GB82 WEST 1234 5698 7654 32"}}'
import json, urllib.request

body = {'input': {'value': 'GB82 WEST 1234 5698 7654 32'}}
request = urllib.request.Request("https://setget.net/v1/tools/luhn-iban-validate", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/luhn-iban-validate", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"value":"GB82 WEST 1234 5698 7654 32"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "luhn-iban-validate",
  "input": {
    "value": "GB82 WEST 1234 5698 7654 32"
  }
}
{
  "input": {
    "value": "GB82 WEST 1234 5698 7654 32"
  }
}

Endpoint: POST /v1/tools/luhn-iban-validate. Over MCP: run_tool with slug: "luhn-iban-validate". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
value string yes The card number or IBAN. Spaces and hyphens are ignored.
kind string no What the value is. "auto" decides from its first characters. One of: auto, card, iban. Default: "auto".

Examples

Input
{
  "value": "GB82 WEST 1234 5698 7654 32"
}
Result
{
  "kind": "iban",
  "valid": true,
  "country": "GB",
  "check_digits": "82",
  "bban": "WEST12345698765432",
  "length": 22,
  "expected_length": 22,
  "checksum_valid": true,
  "formatted": "GB82 WEST 1234 5698 7654 32",
  "problems": []
}

A well-known Visa test number

Input
{
  "value": "4111 1111 1111 1111"
}
Result
{
  "kind": "card",
  "valid": true,
  "network": "Visa",
  "length": 16,
  "luhn_valid": true,
  "length_valid": true,
  "last4": "1111",
  "masked": "************1111",
  "problems": []
}

Questions

Does a valid result mean the card or account exists?
No. It only means the number is well formed. Nothing is looked up and no bank or card network is contacted.
Is my card number stored or shown?
The result repeats only the last four digits. Use published test numbers rather than a real card wherever you can.
How is the network found?
From the first digits and the length. Ranges overlap in places, so treat it as a best guess.