Address lookup architecture
UK Address Lookup and Autocomplete Guide
Address lookup can reduce typing and improve consistency, but it should remain a convenience rather than a gatekeeper. A production-ready flow needs tolerant postcode input, editable results, manual entry and a recovery path when the provider is slow, unavailable or incomplete.
By PostcodeLab · Published · Updated
Choose the lookup pattern for the task
A postcode lookup asks for a postcode first and then returns candidate addresses. Type-ahead autocomplete suggests addresses as the user enters more text. Both can reduce keystrokes, but they have different cost, latency, privacy and accessibility characteristics. Use evidence from the service rather than assuming that one interaction is best for every audience.
The GOV.UK Design System address pattern says to consider postcode lookup and to give users a manual-entry option. If a service collects international addresses, a UK postcode-first flow also needs an obvious country choice or a route that does not apply UK-only rules.
| Pattern | Useful when | Important limitation |
|---|---|---|
| Postcode lookup | The user knows a UK postcode and needs to select a premises | A postcode can contain several addresses and the required one may be missing |
| Address autocomplete | Fast progressive suggestions are supported by an appropriate dataset | Every keystroke may create a provider request unless the client is designed carefully |
| Manual entry | The lookup fails, the address is new, unusual or outside the supported country | Requires clear fields and validation that tolerates genuine variation |
Build a recoverable postcode lookup flow
- Accept upper or lower case and harmless spacing differences in the postcode.
- Normalise the value for the request without replacing the user's visible input unexpectedly.
- Show a clear loading state and prevent duplicate requests while the same lookup is pending.
- Present candidate addresses in a labelled control that works with keyboard and screen-reader navigation.
- Populate the form only after an explicit selection, then keep every returned field editable.
- Preserve the entered postcode and expose manual entry after an empty result, timeout or provider error.
Do not describe a syntax match as an address match. A postcode can have a valid shape without being present in the chosen dataset, and a returned address still does not prove the user's identity, residence or right to use it. The guide to validation versus address verification separates those decisions.
Keep manual entry visible and editable
Manual entry should be available before and after lookup, not hidden behind an error that users must trigger. It covers new builds, properties that are missing from the provider, unusual premises, people who do not know the postcode and addresses outside the supported dataset.
Use address lines that can hold real variation, a separate postcode, a clear town or city label and an optional county unless a documented integration requires a specific administrative concept. Preserve meaningful building and locality text instead of silently forcing the result into an incompatible schema. See the UK address format guide and post town, city and county guide for field design.
Design for accessibility and error recovery
Dynamic suggestions need an interaction model that communicates their label, count, active option and selection state without relying on visual position alone. Test the complete flow with a keyboard and screen reader, at narrow widths and at 200% zoom. Preserve focus predictably when results arrive and do not move focus merely because a background request completed.
- Associate instructions and errors with the postcode or address input.
- Use an error summary that links back to the affected field where the wider form needs one.
- Keep typed values after validation errors and failed submissions.
- Provide a meaningful empty-result message and a direct manual-entry action.
- Allow a selected address to be corrected without starting the entire form again.
- Test slow responses so status updates are announced without becoming repetitive.
Evaluate the provider and data contract
Document the provider, dataset, licence, geographic coverage, update frequency, address lifecycle and fields returned. Decide whether the service needs postal delivery data, geographic reference data, a UPRN, a geocoder result or only postcode syntax. Those sources answer different questions and should not be presented as interchangeable.
Treat provider calls as an external data transfer. Send only the fields needed for the lookup, use encrypted transport, keep credentials on the server where the provider's design allows it, restrict keys by origin or service, and avoid placing full addresses or raw suggestions in analytics and error logs. Set request timeouts and a circuit-breaking policy so an upstream outage cannot block manual submission.
Cache only when the provider's licence and freshness requirements permit it. A long-lived cache can retain corrected or withdrawn records, while no caching can create unnecessary cost and latency. Record the source and retrieval date when downstream decisions need provenance.
Use a focused QA matrix
| Scenario | Expected result |
|---|---|
| Lower-case postcode without a space | Lookup runs after safe normalisation |
| Multiple premises for one postcode | Every option is distinguishable and selectable by keyboard |
| No results | The value is preserved and manual entry is immediately available |
| Timeout, rate limit or server error | A recoverable message appears without losing the form |
| Selected address needs a correction | Populated fields remain editable and submit correctly |
| International or unusual address | The user can bypass the UK-only lookup |
| Provider payload changes | Schema validation fails safely without exposing raw data |
Add contract tests for provider responses and end-to-end tests for selection, manual-entry switching, validation and resubmission. The UK address form QA checklist covers additional layout, export, integration and data-safety cases.
Official references
Related developer guides
UK Address Format: Correct Order and Examples
See the correct UK address format for houses, flats and named buildings, with postcode placement and line-by-line examples for UK and international use.
Read guideUK Address Form Test Cases and QA Checklist
Use practical UK address form test cases for field variation, postcodes, lookup failure, accessibility, mobile layouts, exports and integration safety.
Read guidePostcode Validation vs Address Verification
Compare postcode syntax validation, postcode lookup, address verification, UPRN matching and deliverability checks when designing UK forms and tests.
Read guideUK Post Town vs City and County Fields
Understand UK post towns, town or city inputs, optional county fields and administrative geography when modelling addresses in forms and databases.
Read guide