Download UK Postcodes with Latitude and Longitude

Download a list of UK out code postcodes with their latitude and longitude coordinates.

Introduction

UK and Northern Ireland Postcodes

The UK postal system uses postcodes to help with automating the sorting and delivery of mail. This is made up of a 2-part code, an out code and an in code. As the out code is the most significant part of the system, it can be used to obtain a rough area level break up of the UK. There are approximately 2971 out codes and approximately 1.74M full postcodes (out code + in code).

Purpose

The uses of these out codes and lat/long values include mapping applications such as:

List Status

Outcode Postcodes Current List : 2952

Full UK Postcode Current List : 1781256 (correct on 18th August 2021)

Non Geographic Postcodes

Non geographic postcodes are listed below. Note these will have a latitude and longitude of an empty string

AB99, BT58, CA99, CM92, CM98, CR44, CR90, GIR, IM99, IV99, JE5, M61, ME99, N1C, N81, NR99, NW26, PA80, PE99, RH77, SL60, SO97, SW95, SY99, WD99, WF90

Downloads

Full UK Postcode Latitude Longitude Download

Download the centroid coordinates of each UK Postcode. Only active (valid) postcodes are included.

Outcode Area Postcodes (AB1, B2, BT7 etc..)

Copyright and Reproduction

As per : https://www.ons.gov.uk/methodology/geography/licences

You may re-use this information (not including logos or Northern Ireland data) free of charge in any format or medium, under the terms of the relevant data owners' licence. In addition, the following attribution statements must be acknowledged or displayed whenever the owners data is used:

Contains Ordnance Survey data © Crown copyright and database right 2021

Contains Royal Mail data © Royal Mail copyright and database right 2021

Source: Office for National Statistics licensed under the Open Government Licence v.3.0

Using This Data

To import to a web based MySQL database we would recommend BigDump: Staggered MySQL Dump Importer

Relevant Links

Version History

Comments For This Page

James, we have made a small update to the SQL download file (NULLS instead of empty string). With the new file, the following procedure should work:

Download and run this to create the table: https://data.freemaptools.com/download/full-uk-postcodes/ukpostcodes_tablemssql.sql

From a command prompt, run: sqlcmd -S SERVER -d DATABASE -i -a 32767 C:\path\path\ukpostcodesmssql.sql
By Free Map Tools on 9th August 2022

Hi, you could use a tool to split a CSV in to multiple files.
By Free Map Tools on 8th August 2022

The postcode csv file is too large to download the full list into excel could (its missing data) you split the data into several tabs?
On 31st July 2022

How are people managing to run the insert script on SQL? I'm using latest SSMS. Getting out of memory errors - have increased query size to 4096, and allowing SQL to use the full 32gb ram. I've added Go statements after each insert, and I've tried sqlcmd using C:\Windows>sqlcmd -S MYSQLSERVER -d MYDB -i "C:\db\backups\pc.sql" -E -a 32767 (without the -a I got communication link failure. Now sqlcmd doesn't error, but no records are inserted either. Other than splitting the file up in to 20 or so, which seems like admitting defeat, is there another way?
By James DC on 28th July 2022

Hi, can you provide the script code for the distance between postcodes, i work for a Community Transport and need a simple way of costing the distance
By Anthony on 25th May 2022

DG2 8RX has been updated
By Free Map Tools on 17th April 2022

Ryan, thanks for reporting this. The CSV has been updated with a header row and issue with line breaks fixed.
By Free Map Tools on 16th March 2022

Fantastic resource but a note of warning - the CSV ukpostcodes.zip has corrupted from Line 1774242 (id 2677465) - the records are split over two rows. Any chance this will be resolved on the next refresh?
By Ryan on 16th March 2022

Hi, is it possible to add the outcodes for the UK islands (Jersey, Guernsey, Isle Of Man, etc)? I would be happy to try to work out the lat/long for each if necessary but am surprised your sources aren't including them already.
By Dik on 24th January 2022

Hi, can I have the dataset showing latitudes and longitudes of the LSOAs?
By Preet on 18th September 2021

GL3 1FJ is included in the latest dataset (18th August)
By Free Map Tools on 8th September 2021

Hi-I can't seem to find GL3 1FJ on the postcode file. It's relatively new (introduced April 2021) but I thought that would be caught in the refresh? Thanks
By Kabir on 6th September 2021

I want to plot a map with a specific set of postcodes. How do I do this?
By Adam on 25th June 2021

I think the lat / lng for DG2 8RX is a bit out, should be 55.058885 -3.659007 KR
By mak on 19th May 2021

sssq, thanks for reporting. There was a bug in the file contents. It has now been corrected.
By Free Map Tools on 14th April 2021

The latest ukpostcodesmssql.zip has the first INSERT without values, is that an error or is the sql file is missing records?
By sssq on 14th April 2021

Pankaj, sorry thats not possible.
By Free Map Tools on 25th January 2021

As always, thanks for this site. I have a request, is it possible to add city name to the outcodes too?
By Pankaj on 21st January 2021

Just a note to anyone importing this data. Make sure if using the table schema provided on this website, make sure you set the longitude and latitude columns to nullable, otherwise you will get an error during your import.
By Mark on 26th November 2020

Hi, Thanks for this useful data. I was wondering how "Outcode Area Postcodes" locations were measured? I ask because I've found disparity between that and the full data you offer. I will attempt to roll my own aggregations as you have not covered the outcodes: ['WV98', 'SW95', 'SY99', 'CR90', 'SO97', 'N81', 'CM98', 'EN77', 'WF90', 'SR43', 'N1C', 'RH77', 'ME99', 'CR44', 'SO25', 'NR99', 'WD99', 'CM92', 'M61', 'DL98', 'BN91', 'S95', 'NW26', 'WV99', 'BN95', 'L80']
By L on 24th May 2020

Showing the most recent 20 out of 274 comments. Click to see all the comments.

Add your own comment below and let others know what you think:

Comments

Your Name (optional)

 Post