20

U.K. sites that require addresses often ask the user to provide a postcode. The site then offers the user a choice between the different addresses that match that postcode.

How can I match a postcode to a street address?

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
ctford
  • 7,189
  • 4
  • 34
  • 51

12 Answers12

22

Quick comparison:

Community
  • 1
  • 1
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
16

I believe you need the Royal Mail Postcode Address File. From that link:

PAF is the only complete source of all known UK Postcodes.

Services do exist to handle requests for this info, such that it may be cheaper to use such services for small numbers of requests (obviously you have issues as and when such services aren't available for whatever reasons).

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • 4
    An outdated copy of the PAF was leaked: http://wikileaks.org/wiki/UK_government_database_of_all_1,841,177_post_codes_together_with_precise_geographic_coordinates_and_other_information,_8_Jul_2009 Use at your own peril. – Nick Moore Dec 14 '09 at 11:04
  • 2
    It wasn't the PAF that was leaked, the database on wikileaks has OS (Lat & Long) and Ward data but no actual addresses. – Marko Carter Dec 14 '09 at 11:07
  • 1
    you don't need the PAF. Depending on your traffic, signing up to a commercial vendor that charge on a per-request basis could be much cheaper (and saves you the hassle of building your lookup infrastructure) – Richard H Dec 14 '09 at 11:17
  • @Richard - noted. Answer amended – Brian Agnew Dec 14 '09 at 11:25
  • @BrianAgnew Is there any look up API that returns the name of the building from input post code/ zip code? I am creating an app where I want to register a user only if he is living in a building with multiple apartments/flats > 1. How can I achieve this? – bibscy Sep 08 '18 at 15:58
5

The only way to do it officially up to now has been to buy the Postcode Address File however there was a news item recently that the data may be free in 2010 so depends if you can wait!

James Bloomer
  • 5,212
  • 2
  • 22
  • 23
  • or maybe now: http://www.theregister.co.uk/2009/12/10/ordnance_survey_data_postcode_paf/ – BIDeveloper Dec 14 '09 at 11:07
  • 2
    and this more recent article in the Register (http://www.theregister.co.uk/2010/03/17/ordnance_consultation_survey_deadline) claims: "The Beeb wrongly interpreted that as suggesting that UK.gov was about to wrestle the PAF database from the hands of Royal Mail bosses, who pulled in £1.6m in licensing fees for the service in 2007. However, as we reported, neither the Royal Mail - nor indeed the government - ever had any intentions of freeing up the PAF database for all comers." ... sadly ... – hawbsl Apr 12 '10 at 09:05
  • 1
    As of Dec 2014, PAF is still proprietary and expensive: http://www.poweredbypaf.com/ – mikemaccana Dec 03 '14 at 11:53
5

Contrary to the answers here, you do NOT need the very expensive PAF from the Post Office. There are a number of commercial services (presumably powered by the PAF) that return the streets and street numbers for a specified post code. They generally charged on a per-request basis. I do not have any experience with a particular vendor, but this is an example - capscan

Richard H
  • 38,037
  • 37
  • 111
  • 138
  • 3
    You don't need to buy the PAF from the post office, you need to be able to *access* data *from* the PAF - a subtle but important distinction but when all is said and done, however you get to it, that's the source of the data. – Murph Dec 14 '09 at 14:09
4

To do this you need access to the Postcode Address File - this is something that is licensed for use on an annual basis from the post-office, usually via a third party.

You have a choice depending on your needs of buying a package to use locally or of using web services.

The Royal Mail's page is here: http://www.royalmail.com/portal/rm/jump2?mediaId=400085&catId=400084 and on that page are links to service providers.

Murph
  • 9,985
  • 2
  • 26
  • 41
4

Postcode Anywhere is one of the providers out there (one of my clients uses them with no complaints). Licensing is flexible: Postcode Anywhere UK Address Finder

Ben
  • 7,548
  • 31
  • 45
3

You can use a geocoding service, such as the one provided by Google.

Physical Address to GeoLocation UK

Community
  • 1
  • 1
davek
  • 22,499
  • 9
  • 75
  • 95
2

If you want to get the approximate address for a UK postcode (i.e. street level) there is a way you can do it legally and for free without using PAF data.

  1. Geocode the postcode - This can be done legally for free now. OS have released the codepoint database into the public domain
  2. Do a reverse lookup on the WGS84 lat/lng pair using the Google Maps HTTP Geocoding API to get the street address

As an example of this take a look at this XML Web Service:

http://geo.jamiethompson.co.uk/W127RJ.xml

explained at:

http://jamiethompson.co.uk/projects/2010/04/30/an-open-free-uk-postcode-geocoding-web-service/

which returns:

<result>
    <status>200</status>
    <message/>
    <postcode>W12 7RJ</postcode>
    <geo>
        <os_x>523180</os_x>
        <os_y>180541</os_y>
        <lat>51.510379</lat>
        <lng>-0.226376</lng>
        <landranger>TQ231805</landranger>
        <accuracy>1</accuracy>
        <key>UO1NV-4UO8</key>
    </geo>
<address>
    <street>White City Close</street>
    <locality>Hammersmith</locality>
    <district>Hammersmith</district>
    <county>Greater London</county>
</address>

It's not as handy as the commercial offerings which give you a full list of actual addresses for any given postcode, but it lets you do a "What's your postcode? What's your house number?" type system.

jthompson
  • 843
  • 1
  • 11
  • 20
1

You can either use the PAF or one of the commercial web services (there are a few) which licence the PAF. I think you usually buy "credits" or pay a flat rate for unlimited access.

dsas
  • 1,650
  • 18
  • 30
1

To add to the answers already coming through:

In the paid for products typically you pay for either:

  • premise level - more detailed and can offer the user a list of premises at that postcode location

  • street level - simply matches the street at that postcode location - you or your user fills in "the first line of the address" usually house name or number

I believe this differentiation is built into the licencing by the Royal Mail at source. Premise level is substantially more expensive

hawbsl
  • 15,313
  • 25
  • 73
  • 114
1

If you're adding it into a website shopping cart or similar system, you can buy access to the data on a per-click basis. If you're using it for an internal system such as CRM, you need to buy a per-user license.

Either way, you can use the Data8 Postcode Lookup API via web services.

1

You don't need to purchase the Royal Mail Postcode Address File (PAF). There are lots of APIs available.

getaddress.io is the only one I've found that has a free plan:

https://getaddress.io

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
Lee Smith
  • 6,339
  • 6
  • 27
  • 34
  • getaddress.io have a free plan but the free plan limited to a certain amount of API calls a day - I've edited your answer to say that. However http://getaddress.io is far cheaper than http://www.postcodeanywhere.co.uk/ – mikemaccana Dec 03 '14 at 12:00