ASN Database Downloads (JSON / CSV)

Autor:Lisa Farrell · 2025-07-29

The ASN Database maps Autonomous System Numbers (ASNs) to IP prefixes (IPv4 / IPv6). It helps determine which ISP/cloud provider/institution an IP belongs to, supporting use cases like proxy traffic steering, network analytics, routing optimization, and security & risk control. ASN data is typically derived from BGP route announcements, closely reflecting real network ownership.

What Is an ASN?

An ASN (Autonomous System Number) is assigned to an independent administrative network domain. Each ASN represents a network operated under a single organization and advertised as a distinct routing entity. Examples: China Telecom (AS4134), China Mobile (AS9808), and China Education and Research Network (AS4538).

Think of an ASN as a “network ID.” With it, you can quickly identify the upstream network, ISP, or cloud provider behind an IP.

What Can the ASN Database Do?

  • Identify the network or organization associated with an IP (ISPs, cloud providers, universities, etc.).
  • Route precisely by ASN (e.g., domestic vs. foreign, the “big three” carriers, or specific cloud providers).
  • Network optimization: apply ASN-based routing preferences, node scheduling, and QoS policies.
  • Security analysis: trace anomalous traffic; flag cloud proxy space/IDC space/residential ranges.

Schema (Column Definitions)

The two tables share the same structure:

  • start_ip: Start IP (IPv4/IPv6).
  • end_ip: End IP (IPv4/IPv6).
  • asn: Autonomous System Number (integer).
  • country_code: Country/region code (e.g., US, CN).
  • organization: Organization/company/network name.

Table names: asn_ipv4_prefixes and asn_ipv6_prefixes.

Downloads

Three output formats are available—JSON (.gz), CSV (.gz), and SQL (.gz)—covering both IPv4 and IPv6.

Source Type Format Download Notes
IPIN IPv6 JSON (.gz) ASN → IPv6 prefix mapping as a JSON array; program-friendly.
IPIN IPv6 CSV (.gz) Standard comma-delimited with header; ideal for spreadsheets/ETL.
IPIN IPv6 SQL (.gz) Includes DDL and INSERT statements for direct MySQL import.
IPIN IPv4 JSON (.gz) ASN → IPv4 prefix mapping as a JSON array; program-friendly.
IPIN IPv4 CSV (.gz) Standard comma-delimited with header; ideal for spreadsheets/ETL.
IPIN IPv4 SQL (.gz) Includes DDL and INSERT statements for direct MySQL import.

Note: all files are .gz archives. Extract with gunzip or stream them directly in your program.

Quick CLI Downloads

curl

# IPv6 JSON
curl -fL -OJ 'https://ipin.io/download/export?type=ipv6&format=json'

# IPv6 CSV
curl -fL -OJ 'https://ipin.io/download/export?type=ipv6&format=csv'

# IPv6 SQL
curl -fL -OJ 'https://ipin.io/download/export?type=ipv6&format=sql'

# IPv4 JSON
curl -fL -OJ 'https://ipin.io/download/export?type=ipv4&format=json'

# IPv4 CSV
curl -fL -OJ 'https://ipin.io/download/export?type=ipv4&format=csv'

# IPv4 SQL
curl -fL -OJ 'https://ipin.io/download/export?type=ipv4&format=sql'

wget

# Use server-provided filenames (--content-disposition)
# IPv6
wget --content-disposition 'https://ipin.io/download/export?type=ipv6&format=json'
wget --content-disposition 'https://ipin.io/download/export?type=ipv6&format=csv'
wget --content-disposition 'https://ipin.io/download/export?type=ipv6&format=sql'

# IPv4
wget --content-disposition 'https://ipin.io/download/export?type=ipv4&format=json'
wget --content-disposition 'https://ipin.io/download/export?type=ipv4&format=csv'
wget --content-disposition 'https://ipin.io/download/export?type=ipv4&format=sql'

# Specify filename + resume
wget -c -O asn_ipv6_prefixes.json.gz 'https://ipin.io/download/export?type=ipv6&format=json'
wget -c -O asn_ipv6_prefixes.csv.gz  'https://ipin.io/download/export?type=ipv6&format=csv'
wget -c -O asn_ipv6_prefixes.sql.gz  'https://ipin.io/download/export?type=ipv6&format=sql'
wget -c -O asn_ipv4_prefixes.json.gz 'https://ipin.io/download/export?type=ipv4&format=json'
wget -c -O asn_ipv4_prefixes.csv.gz  'https://ipin.io/download/export?type=ipv4&format=csv'
wget -c -O asn_ipv4_prefixes.sql.gz  'https://ipin.io/download/export?type=ipv4&format=sql'

aria2c (multi-connection)

# IPv6
aria2c -x16 -s16 -k1M -o asn_ipv6_prefixes.json.gz 'https://ipin.io/download/export?type=ipv6&format=json'
aria2c -x16 -s16 -k1M -o asn_ipv6_prefixes.csv.gz  'https://ipin.io/download/export?type=ipv6&format=csv'
aria2c -x16 -s16 -k1M -o asn_ipv6_prefixes.sql.gz  'https://ipin.io/download/export?type=ipv6&format=sql'

# IPv4
aria2c -x16 -s16 -k1M -o asn_ipv4_prefixes.json.gz 'https://ipin.io/download/export?type=ipv4&format=json'
aria2c -x16 -s16 -k1M -o asn_ipv4_prefixes.csv.gz  'https://ipin.io/download/export?type=ipv4&format=csv'
aria2c -x16 -s16 -k1M -o asn_ipv4_prefixes.sql.gz  'https://ipin.io/download/export?type=ipv4&format=sql'

PowerShell

# IPv6
Invoke-WebRequest -Uri "https://ipin.io/download/export?type=ipv6&format=json" -OutFile "asn_ipv6_prefixes.json.gz"
Invoke-WebRequest -Uri "https://ipin.io/download/export?type=ipv6&format=csv"  -OutFile "asn_ipv6_prefixes.csv.gz"
Invoke-WebRequest -Uri "https://ipin.io/download/export?type=ipv6&format=sql"  -OutFile "asn_ipv6_prefixes.sql.gz"

# IPv4
Invoke-WebRequest -Uri "https://ipin.io/download/export?type=ipv4&format=json" -OutFile "asn_ipv4_prefixes.json.gz"
Invoke-WebRequest -Uri "https://ipin.io/download/export?type=ipv4&format=csv"  -OutFile "asn_ipv4_prefixes.csv.gz"
Invoke-WebRequest -Uri "https://ipin.io/download/export?type=ipv4&format=sql"  -OutFile "asn_ipv4_prefixes.sql.gz"

Tip: these are .gz archives—use gunzip or a decompression tool, or stream them directly in your application.

How to Use (Quick Start)

  1. Download and extract the JSON / CSV / SQL files (or process the decompressed stream directly).
  2. Import into your database or load into your in-memory model.
  3. Apply routing or security policies by ASN/organization/country (e.g., preferred routes, allow/deny lists).
  4. Schedule periodic updates (e.g., daily/weekly) for automatic refreshes.

Format Reference

JSON

Array of objects with start_ip, end_ip, asn, country_code, and organization.

CSV

Header row included; fields with commas/quotes are escaped per RFC 4180.

SQL

Includes table DDL and bulk INSERT statements for direct MySQL import.

Additional Notes

The dataset aggregates BGP routing data and public registry information. If you only need mainland China ASNs, see bgp.he.net/country/CN.

FAQ

  • Why is CSV sometimes smaller/larger than JSON? Differences come from string escaping and field redundancy. Both contain the same information—choose based on your processing pipeline.
  • Is incremental update supported? Exports are currently full snapshots. Use scheduled jobs to overwrite-import.
  • Download failed or timed out? Try curl/wget/aria2c above and make sure large-file downloads are allowed. Server-side streaming compression is enabled for big tables.