- IP-COUNTRY Database
- IP-COUNTRY-REGION-CITY Database
- IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE Database
- IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE Database
- IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database
- IP2Proxy LITE IP-COUNTRY Database
- IP2Proxy LITE IP-PROXYTYPE-COUNTRY Database
- IP2Proxy LITE IP-PROXYTYPE-COUNTRY-REGION-CITY Database
- IP2Proxy LITE IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP Database
- IP-ASN Database

IP2Location™ LITE IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database
IP2Location™ LITE IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE Database provides a solution to determine the country, region or state, city, latitude, longitude, ZIP code and time zone of origin for any IP address in a few simple steps. First, retrieve the IP address from the networking protocol or server-side variable of the Web server. Next, translate the IP address to an IP number in decimal format to speed up the database query. Lastly, reverse lookup the IP number from the IP2Location™ database to pinpoint the exact geographical location.
The LITE edition is a free version of database with limited accuracy & number of records compares to commercial release. It is free for personal or commercial use with attribution required by mentioning the use of this data as follows,
Please get the commercial edition if you are looking for high data accuracy, more records & customer support. Please visit product comparison page for more information.
Free Download
IPv4 CSV IPv4 BIN IPv6 CSV IPv6 BINFeatures | Translates IP address to country, region or state, city, latitude and longitude, US ZIP code and time zone. |
Current Version | April 2018 |
Database Size | 51.21 MB (3,333,330 Rows) |
Database Format | ASCII Text File (Comma Delimited) & Binary (BIN) |
Name | Type | Description |
ip_from | INT (10)† / DECIMAL (39,0)†† | First IP address in netblock. |
ip_to | INT (10)† / DECIMAL (39,0)†† | Last IP address in netblock. |
country_code | CHAR(2) | Two-character country code based on ISO 3166. |
country_name | VARCHAR(64) | Country name based on ISO 3166. |
region_name | VARCHAR(128) | Region or state name. |
city_name | VARCHAR(128) | City name. |
latitude | DOUBLE | City latitude. Default to capital city latitude if city is unknown. |
longitude | DOUBLE | City longitude. Default to capital city longitude if city is unknown. |
zip_code | VARCHAR(30) | ZIP/Postal code. |
time_zone | VARCHAR(8) | UTC time zone (with DST supported). If you are looking for Olson Time Zone, please visit here. |
† IPv4
†† IPv6
Below are the steps to set up the database for both IPv4 and IPv6 data.
Create table
CREATE DATABASE ip2location; USE ip2location; CREATE TABLE `ip2location_db11`( `ip_from` INT(10) UNSIGNED, `ip_to` INT(10) UNSIGNED, `country_code` CHAR(2), `country_name` VARCHAR(64), `region_name` VARCHAR(128), `city_name` VARCHAR(128), `latitude` DOUBLE, `longitude` DOUBLE, `zip_code` VARCHAR(30), `time_zone` VARCHAR(8), INDEX `idx_ip_from` (`ip_from`), INDEX `idx_ip_to` (`ip_to`), INDEX `idx_ip_from_to` (`ip_from`, `ip_to`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Import the database
LOAD DATA LOCAL INFILE 'IP2LOCATION-LITE-DB11.CSV' INTO TABLE `ip2location_db11` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 0 LINES;
Create table
CREATE DATABASE ip2location GO USE ip2location GO CREATE TABLE [ip2location].[dbo].[ip2location_db11]( [ip_from] float NOT NULL, [ip_to] float NOT NULL, [country_code] nvarchar(2) NOT NULL, [country_name] nvarchar(64) NOT NULL, [region_name] nvarchar(128) NOT NULL, [city_name] nvarchar(128) NOT NULL, [latitude] float NOT NULL, [longitude] float NOT NULL, [zip_code] nvarchar(30) NOT NULL, [time_zone] nvarchar(8) NOT NULL ) ON [PRIMARY] GO CREATE INDEX [ip_from] ON [ip2location].[dbo].[ip2location_db11]([ip_from]) ON [PRIMARY] GO CREATE INDEX [ip_to] ON [ip2location].[dbo].[ip2location_db11]([ip_to]) ON [PRIMARY] GO
Import the database
BULK INSERT [ip2location].[dbo].[ip2location_db11] FROM 'C:\[path to your CSV file]\IP2LOCATION-LITE-DB11.CSV' WITH ( FORMATFILE = 'C:\[path to your DB11.FMT file]\DB11.FMT' ) GO
DB11.FMT
NOTE: You will need to copy the FMT code below and save it as a file named DB11.FMT on your computer. The first line of the FMT code indicates the version of bcp. Please change the version as according to your MS-SQL installed.
SQL Server 2016 | 12.0 |
SQL Server 2014 | 12.0 |
SQL Server 2012 | 11.0 |
SQL Server 2008/2008R2 | 10.0 |
SQL Server 2005 | 9.0 |
SQL Server 2000 | 8.0 |
SQL Server 7.0 | 7.0 |
SQL Server 6.5 | 6.5 |
10.0 11 1 SQLCHAR 0 1 "\"" 0 first_double_quote Latin1_General_CI_AI 2 SQLCHAR 0 20 "\",\"" 1 ip_from "" 3 SQLCHAR 0 20 "\",\"" 2 ip_to "" 4 SQLCHAR 0 2 "\",\"" 3 country_code Latin1_General_CI_AI 5 SQLCHAR 0 64 "\",\"" 4 country_name Latin1_General_CI_AI 6 SQLCHAR 0 128 "\",\"" 5 region_name Latin1_General_CI_AI 7 SQLCHAR 0 128 "\",\"" 6 city_name Latin1_General_CI_AI 8 SQLCHAR 0 20 "\",\"" 7 latitude "" 9 SQLCHAR 0 20 "\",\"" 8 longitude "" 10 SQLCHAR 0 30 "\",\"" 9 zip_code Latin1_General_CI_AI 11 SQLCHAR 0 8 "\"\r\n" 10 time_zone Latin1_General_CI_AI
Create table
CREATE DATABASE ip2location WITH ENCODING 'UTF8'; \c ip2location CREATE TABLE ip2location_db11( ip_from bigint NOT NULL, ip_to bigint NOT NULL, country_code character(2) NOT NULL, country_name character varying(64) NOT NULL, region_name character varying(128) NOT NULL, city_name character varying(128) NOT NULL, latitude real NOT NULL, longitude real NOT NULL, zip_code character varying(30) NOT NULL, time_zone character varying(8) NOT NULL, CONSTRAINT ip2location_db11_pkey PRIMARY KEY (ip_from, ip_to) );
Import the database
COPY ip2location_db11 FROM 'IP2LOCATION-LITE-DB11.CSV' WITH CSV QUOTE AS '"';
Create table
CREATE DATABASE ip2location GO USE ip2location GO CREATE TABLE [ip2location].[dbo].[ip2location_db11_ipv6]( [ip_from] char(39) NOT NULL, [ip_to] char(39) NOT NULL, [country_code] nvarchar(2) NOT NULL, [country_name] nvarchar(64) NOT NULL, [region_name] nvarchar(128) NOT NULL, [city_name] nvarchar(128) NOT NULL, [latitude] float NOT NULL, [longitude] float NOT NULL, [zip_code] nvarchar(30) NOT NULL, [time_zone] nvarchar(8) NOT NULL ) ON [PRIMARY] GO CREATE INDEX [ip_from] ON [ip2location].[dbo].[ip2location_db11_ipv6]([ip_from]) ON [PRIMARY] GO CREATE INDEX [ip_to] ON [ip2location].[dbo].[ip2location_db11_ipv6]([ip_to]) ON [PRIMARY] GO
Import the database
BULK INSERT [ip2location].[dbo].[ip2location_db11_ipv6] FROM 'C:\[path to your CSV file]\IP2LOCATION-LITE-DB11.IPV6.CSV' WITH ( FORMATFILE = 'C:\[path to your DB11.FMT file]\DB11.FMT' ) GO
DB11.FMT
NOTE: You will need to copy the FMT code below and save it as a file named DB11.FMT on your computer. The first line of the FMT code indicates the version of bcp. Please change the version as according to your MS-SQL installed.
SQL Server 2008/2008R2 | 10.0 |
SQL Server 2005 | 9.0 |
SQL Server 2000 | 8.0 |
SQL Server 7.0 | 7.0 |
SQL Server 6.5 | 6.5 |
10.0 11 1 SQLCHAR 0 1 "\"" 0 first_double_quote Latin1_General_CI_AI 2 SQLCHAR 0 39 "\",\"" 1 ip_from "" 3 SQLCHAR 0 39 "\",\"" 2 ip_to "" 4 SQLCHAR 0 2 "\",\"" 3 country_code Latin1_General_CI_AI 5 SQLCHAR 0 64 "\",\"" 4 country_name Latin1_General_CI_AI 6 SQLCHAR 0 128 "\",\"" 5 region_name Latin1_General_CI_AI 7 SQLCHAR 0 128 "\",\"" 6 city_name Latin1_General_CI_AI 8 SQLCHAR 0 20 "\",\"" 7 latitude "" 9 SQLCHAR 0 20 "\",\"" 8 longitude "" 10 SQLCHAR 0 30 "\",\"" 9 zip_code Latin1_General_CI_AI 11 SQLCHAR 0 8 "\"\r\n" 10 time_zone Latin1_General_CI_AI
NOTE: Due to the fact that SQL Server does not support a number with more than 38 digits, we have to store the IP From and IP To fields as zero padded strings to enable sorting. Please visit this tutorial on how to add the padding, enable cluster index and make the query.
Create table
CREATE DATABASE ip2location; USE ip2location; CREATE TABLE `ip2location_db11_ipv6`( `ip_from` DECIMAL(39,0) UNSIGNED NULL DEFAULT NULL, `ip_to` DECIMAL(39,0) UNSIGNED NOT NULL, `country_code` CHAR(2), `country_name` VARCHAR(64), `region_name` VARCHAR(128), `city_name` VARCHAR(128), `latitude` DOUBLE, `longitude` DOUBLE, `zip_code` VARCHAR(30), `time_zone` VARCHAR(8), INDEX `idx_ip_from` (`ip_from`), INDEX `idx_ip_to` (`ip_to`), INDEX `idx_ip_from_to` (`ip_from`, `ip_to`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Import the database
LOAD DATA LOCAL INFILE 'IP2LOCATION-LITE-DB11.IPV6.CSV' INTO TABLE `ip2location_db11_ipv6` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 0 LINES;
Create table
CREATE DATABASE ip2location WITH ENCODING 'UTF8'; \c ip2location CREATE TABLE ip2location_db11_ipv6( ip_from decimal(39,0) NOT NULL, ip_to decimal(39,0) NOT NULL, country_code character(2) NOT NULL, country_name character varying(64) NOT NULL, region_name character varying(128) NOT NULL, city_name character varying(128) NOT NULL, latitude real NOT NULL, longitude real NOT NULL, zip_code character varying(30) NOT NULL, time_zone character varying(8) NOT NULL, CONSTRAINT ip2location_db11_pkey PRIMARY KEY (ip_from, ip_to) );
Import the database
COPY ip2location_db11_ipv6 FROM 'IP2LOCATION-LITE-DB11.IPV6.CSV' WITH CSV QUOTE AS '"';
IP2Location provides a free, pre-configured & ready-to-run AMI and images to easily set up the database.
Please visit IP2Location Developers and IP2Location Tutorials for details. Sample BIN databases and source codes are available for download.
Ready to upgrade to our commercial edition for better accuracy?
- Login to account area.
- Click on the Upgrade button (on the right of the package listing).
- You will be redirected to http://www.ip2location.com to complete your order.
- You will receive your download instructions once payment is completed.
You can automate the download process using the free download script in command prompt or shell. Please visit IP2Location DB11 for details.
License Agreement: General Terms and Conditions for the database licensing.