Geo IP database
Country + city metadata for public IPs. Use this for location and country code lookups.
Supports IPv4 + IPv6.
Free download
Free MaxMind DB (mmdb) files for IP-to-Geo and IP-to-ASN lookups. It's free for use.
MIT license. No sign-up. No rate limits.
Updated Feb 1 (updates weekly).
Country + city metadata for public IPs. Use this for location and country code lookups.
Supports IPv4 + IPv6.
ASN number + organization name for public IPs. Use this for network ownership and ASN lookups.
Supports IPv4 + IPv6.
Usage
Pick your language and load the MMDB file with the MaxMind DB reader for that ecosystem.
import maxmind from 'maxmind';
const reader = await maxmind.open('ip2geo-nossl-sh.mmdb');
const record = reader.get('216.73.216.118');
console.log(record);
// swap file name to ip2asn-nossl-sh.mmdb for ASN data
import maxminddb
reader = maxminddb.open_database('ip2geo-nossl-sh.mmdb')
record = reader.get('216.73.216.118')
print(record)
# swap file name to ip2asn-nossl-sh.mmdb for ASN data
import (
"fmt"
"net"
"github.com/oschwald/maxminddb-golang"
)
db, _ := maxminddb.Open("ip2geo-nossl-sh.mmdb")
defer db.Close()
var record map[string]interface{}
db.Lookup(net.ParseIP("216.73.216.118"), &record)
fmt.Printf("%v\n", record)
// swap file name to ip2asn-nossl-sh.mmdb for ASN data
use maxminddb::Reader;
use std::net::IpAddr;
let reader = Reader::open_readfile("ip2geo-nossl-sh.mmdb").unwrap();
let ip: IpAddr = "216.73.216.118".parse().unwrap();
let record: serde_json::Value = reader.lookup(ip).unwrap();
println!("{}", record);
// swap file name to ip2asn-nossl-sh.mmdb for ASN data
import com.maxmind.db.Reader;
import java.io.File;
import java.net.InetAddress;
import java.util.Map;
Reader reader = new Reader(new File("ip2geo-nossl-sh.mmdb"));
InetAddress ip = InetAddress.getByName("216.73.216.118");
Map<String, Object> record = reader.get(ip);
System.out.println(record);
// swap file name to ip2asn-nossl-sh.mmdb for ASN data
<?php
use MaxMind\Db\Reader;
$reader = new Reader('ip2geo-nossl-sh.mmdb');
$record = $reader->get('216.73.216.118');
print_r($record);
// swap file name to ip2asn-nossl-sh.mmdb for ASN data
Example data
Example response pulled from the current request IP.
{
"ip": "216.73.216.118",
"countryCode": "US",
"countryFlag": "🇺🇸",
"countryName": "United States",
"cityName": "Columbus",
"orgName": "AMAZON-02",
"asn": "16509"
}
$ curl 'http://nossl.sh/api/ip?216.73.216.118'
License
These files are provided under the MIT License - free to use, modify, and redistribute, including commercial use.
Support
This is a free-to-use project. If it helps, consider supporting it.