Download UK Postcodes with Latitude and Longitude
Download a list of UK out code postcodes with their latitude and longitude coordinates.
Introduction

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:
- Rough distance calculation
- Plot the rough location of a postcode on a map
- Simple postcode validation for input forms
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.
- CSV ukpostcodes.zip (20MB zipped, 64MB unzipped)
- Header is in the first row : id,postcode,latitude,longitude
- SQL Server MSSQL ukpostcodesmssql.zip (19MB zipped, 177MB unzipped)
- Uses a table named [postcodelatlng]
- Script to create table ukpostcodes_tablemssql.sql (1 KB)
- MySQL ukpostcodesmysql.zip (24MB zipped, 191MB unzipped)
- Uses a table named [postcodelatlng]
- Script to create table ukpostcodes_tablemysql.sql (1 KB)
Outcode Area Postcodes (AB1, B2, BT7 etc..)
- MSSQL postcode-outcodes-mssql.sql (293 KB)
- Uses a table named [postcodelatlng]
- Script to create table postcode-outcodes_tablemssql (1 KB)
- MySQL postcode-outcodes-mysql (280 KB)
- Uses a table named postcodelatlng
- Script to create table postcode-outcodes_tablemysql.sql (1 KB)
- CSV postcode-outcodes.csv (82 KB)
- Header is in the first row : id,outcode,latitude,longitude
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
- https://www.ordnancesurvey.co.uk/opendatadownload/products.html - OS OpenData Downloads
- https://en.wikipedia.org/wiki/Haversine_formula
- https://mathforum.org/library/drmath/view/51879.html
- https://www.movable-type.co.uk/scripts/latlong.html
- MySQL UK post code table with corresponding longitude and latitude
- Calculating the distance between a set of postcodes and ranking them in order
Version History
- 13th March 2022 - Dataset refresh
- 18th August 2021 - Dataset refresh
- 9th August 2021 - Dataset refresh
- 19th March 2021 - New dataset refresh. Number of decimal places reduced to 6
- 16th November 2020 - New dataset refresh
- 23rd March 2020 - New dataset refresh
- 12th July 2019 - New dataset refresh
- 19th May 2017 - General Updates. All non-geo postcoces now have an empty latitude,longitude e.g. VALUES (1682513, 'EN77 1AB', '','');
- 4th January 2017 - Updates 54 lat/lng previously set to 99.9,0
- 23rd December 2016 - Updates to data - Remove some instances of ??? O?? (O is letter O)
- 17th October 2016 - Updates to data files
- 11th August 2016 - Updates to B9 4AU, MK11 4AL & DN189AH
- 22nd July 2016 - Updates to SW11 7AS, EX6 9AA, EN77 & WV98
- 16th November 2015 - November 2015 update
- 19th October 2015 - Removed some duplicates
- 23rd September 2015 - Postcode column now has a space in the appropriate place
- 7th May 2015 - Some no loner used postcodes removed. Around 3000 corrections based on feedback
- 29th April 2015 - New update engine in place. Now provides MS SQL and MySQL script
- 5th March 2015 - Added B37 7FP
- 16th July 2014 - Added BB12 7BF
- 9th February 2014 - Added S1 4DE
- 9th February 2014 - Updated Full postcode list. 222 duplicates removed
- 9th February 2014 - Updated Outcode data. SQL script is for MSSQL
- 20th January 2014 - Removed 2 rows of incorrect data. Rows 1699835 and 1699836
- 11th September 2013 - Removed Duplicate BD98 And M60
- 1st August 2013 - Added full postcode list CSV and SQL (SQL insert) format with 1703751 rows
- 15th September 2011 - Added E20 (Olympic Park Postcodes)
- 23rd February 2011 - Added AB24, B99, BB94, BD97, BD98, BD98, BD99, BL11, BL78, BN50, BN51, BN52, BN88, BN99, BS80, BS98, CA95, CF30, CF91, CF95, CF99, CH25, CH26, CH27, CH28, CH29, CH30, CH31, CH32, CH33, CH34, CH70, CH88, CH99, CM77, CM99, CR9, CT50, CW98, DE99, DH97, DH98, DH99, DN55, E77, E98, EC1P, EC2P, EC4P, EC50, EH91, EH95, EH99, FY0, G58, G70, G75, G79, G9, G90, GU95, IP98, KY99, L67, L68, L71, L72, L73, L74, L75, LE19, LE21, LE41, LE55, LE87, LE94, LE95, LS88, LS98, LS99, M50, M60, M99, MK77, N1P, NE82, NE83, NE85, NE88, NE92, NE98, NG70, NG80, NG90, NW1W, OL95, PL95, PR0, PR11, S49, S96, S97, S98, S99, SA80, SA99, SE1P, SL95, SN38, SN99, SS22, SS99, ST55, SW99, TR93, UB18, W1A, WA55, WA88, WR78, WR99, YO90, YO91
- 27th June 2009 - Added NR7
- 22nd October 2008 - Added some Isle of Man and Jersey Postcodes. XLS format is no longer provided.
- 24th August 2008 - Added some new postcodes
- 1st July 2008 - Added List Status
- 10th June 2008 - Added SQL, CSV and XLS formats each with 2821 rows
Comments For This Page
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
Thanks Luisll, the name of the PK has been updated.
By Free Map Tools on 1st May 2020
Thank you for this great tool.
Script to create table postcode-outcodes_tablemssql has a mistake:
"CONSTRAINT [PK_postcodelatlng] PRIMARY KEY CLUSTERED"
should be "CONSTRAINT [PK_outcodepostcodes] PRIMARY KEY CLUSTERED"
By Luisll on 1st May 2020
Thank you for this resource. The webpage say "Non geographic postcodes are listed below. Note these will have a latitude and longitude of an empty string." In the CSV file 'postcode-outcodes.csv' they are not empty but '0'.
By Jonathan. on 25th March 2020
I live at 20 Guardians Court, NE20 9UG but due to an error in one of the postcode databases the postcode sometimes generates North Road. The latter has the postcode NE20 9UH. Would you please check your database produces Guardians Court when you input NE20 9UG. Thanks
By Jackie Park Harris on 24th February 2020
Which file are you looking inside?
By Free Map tools on 19th February 2020
Showing the most recent 20 out of 269 comments. Click to see all the comments.
Add your own comment below and let others know what you think:
Comments
Your Name (optional)