Skip to the content

Address Formatting

Get addresses back in a format to match your form

Overview

Raw addresses from PAF are split over 24 fields.

We provide both the raw version and a formatted version for you to use. As there are many ways your address form could be laid out, we provide comprehensive options to create the formatted version from the raw version in a way that will match your requirements.

These options apply to the GetFullAddress, FindFullAddress and FetchAddress methods. They are described briefly on those individual method documentation pages, but are also described in more depth below.

Raw PAF Addresses

The raw PAF data presents addresses across 24 individual fields.

All our methods that return an address include the full raw address. If you are using our service to populate a standard address form this will probably not be useful for you, but it is worth understanding what information is available in these fields. Note that for most addresses, many of these fields will be blank.

Field Description Example
Organisation The name of the company at the address DATA8 LTD
Department The department within the organisation at the address FINANCE DEPARTMENT
AddressKey Combines with OrganisationKey and PostcodeType to provide a unique key for this address 3857290484
OrganisationKey Combines with AddressKey and PostcodeType to provide a unique key for this address. Will be 0 for residential addresses 1294245
PostcodeType Indicates if the address is on a "small user" ("S") or "large user" ("L"). A large user postcode is one that is allocated to an individual organisation as a heavy mail user, e.g. DVLA S
BuildingNumber The house number for the address. Note that this is an integer number only. Building numbers such as 12A will be shown in the BuildingName field 32
SubBuildingName The name of the sub-building for the address. This is typically a flat or apartment number FLAT 4
BuildingName The name of the building. May include number information where the number is not a simple integer ROSE COTTAGE 13A
DependentThoroughfareName The name of the dependent thoroughfare, i.e. a smaller street off a larger street PINE
DependentThoroughfareDesc The descriptor ("street", "road" etc.) of the dependent thoroughfare CLOSE
ThoroughfareName The name of the main street HIGH
ThoroughfareDesc The descriptor of the main street ROAD
DoubleDependentLocality The name of the double-dependent locality - the third-level locality GATEWAY BUSINESS PARK
DependentLocality The name of the dependent locality - the second level locality TORRY
Locality The name of the top-level postal town LONDON
Postcode The postcode in a fixed 7-character format CH2 4NE
Dps The 2-character delivery point suffix that uniquely identifies the address within the postcode 3S
PoBox The details of the PO Box if the address is a PO Box address PO BOX 90
PostalCounty The county name that should appear in the address ABERDEENSHIRE
TraditionalCounty The county name that was traditionally associated with the address but is not now postally required CHESHIRE
AdministrativeCounty The county that the address is in for administrative purposes but is not postally required CHESHIRE WEST AND CHESTER
CountryISO2 The 2-character ISO country code related to the address. This is not populated by the AddressCapture service GB
UniqueReference An alternative unique reference number for the address. This is set to the UDPRN number of the address by supplying the IncludeUDPRN option to the method 43528349
Location The geocoding details for the address. This will be populated if the IncludeLocation option is set to true { Easting: 342453, Northing: 343064, GridReference: "SD432535", Longitude: 4.32313, Latitude: 53.234234 }

Formatting Options

There are many options which control how we convert these 24 fields to a human-readable version.

Name Description Default
Formatter

Pick from one of the available formatters to control how the raw address is converted into a human-readable address:

  • DefaultFormatter
  • PAFStandardFormatter
  • NoOrganisationFormatter

While the PAFStandardFormatter applies the rules documented by Royal Mail exactly, DefaultFormatter produces an address in a more common format that is more likely to meet your needs. NoOrganisationFormatter will produce the same output as DefaultFormatter but with any organisation and department information ignored, so only what is more typically thought of as the address information is returned.

DefaultFormatter
MaxLines The number of lines that the address, excluding the postcode, will be formatted over. An extra line will be included at the end to hold the postcode. 6
MaxLineLength The maximum number of characters that can be on a single line. Set this to match the maximum length of the data fields you are putting the address into. This is used to help control where information is wrapped onto different lines 255
FixTownCounty If you have separate fields for the town and county parts of the address, set this to true to ensure that the last two lines will always be populated with the town and county respectively. Note that the county may be blank, in which case there will be a blank line at the end. true
FixBuilding Ensures the building name/number is returned separately in the first address line instead of being combined with the street name false
NormalizeCase All raw data from Royal Mail is provided in upper case only. Set this to true to convert it to proper case. This does not apply to the town name - that is controlled separately by the NormalizeTownCase option true
NormalizeTownCase Set this to true to convert the town name to proper case. Royal Mail recommends the town name is presented in upper case on envelopes false
UseAnyAvailableCounty The formatted address by default shows only the PostalCounty from the raw PAF address, which is often blank. If a county name is essential, set this to true to fall back to the TraditionalCounty and AdministrativeCounty fields to populate the county name in more cases false
ExcludeCounty County names are not required by Royal Mail for mail delivery. Set this to true to exclude the county name from the formatted address false
UnwantedPunctuation If the system you are entering addresses into cannot handle certain special characters in the address fields, list those characters in this option to ensure they are not included in the formatted address ""

Live Demo

See the effect of different formatting options with our live demo.

Raw address to format

Only the address fields that have an impact on the formatted address are shown below.

Formatting Options

Specify the options to reformat this address with: