---
title: "Area code lookup widget for your website"
url: "https://lookvalid.com/tools/area-code/widget.md"
canonical_url: "https://lookvalid.com/tools/area-code/widget"
last_updated: "2026-10-19"
type: "tool"
summary: "Embed an area code lookup on your site with two lines of HTML. Shows the state or province and neighbouring codes, runs in the browser, sets no cookies."
related: ["https://lookvalid.com/area-code.md"]
---

# Area code lookup widget for your website

Embed an area code lookup on your site with two lines of HTML. Shows the state or province and neighbouring codes, runs in the browser, sets no cookies.

Add an area code lookup to any web page with two lines of HTML. A visitor types a three digit code and sees the state or province, the country and the other area codes in the same region.

## Embed code

```html
<div class="lookvalid-area-code" data-code="312" data-size="420"></div>
<script async src="https://lookvalid.com/widgets/area-code.js"></script>
```

## Sizes

- 300: 300 pixels wide. A sidebar, a footer or a narrow column.
- 420: 420 pixels wide. The default, a good fit for an article or a contact page.
- full: The full width of its container. A wide layout where the widget should line up with the text around it.

## Attributes

- class="lookvalid-area-code" (Required on the div): Marks the element the widget fills. The attribute data-lookvalid-area-code works the same way.
- data-code (Three digits, optional): An area code to show when the page loads. Left out, the field starts empty.
- data-size (300, 420 or full): The width of the widget. Left out, it is 420.
- data-credit (true or false): Shows or hides the small LookValid link under the field. Left out, the link is shown.

## How it works

The script requests one static file, https://lookvalid.com/widgets/area-codes.json, and answers every lookup in the visitor's browser. It sets no cookies, uses no browser storage, loads no analytics and needs no key.

## Data source

The 427 geographic area codes in service for the United States and Canada come from the North American Numbering Plan Administrator NPA report (https://reports.nanpa.com/public/npa_report.csv), file dated 2026-10-17.

## Frequently asked questions

### Does the widget set cookies or track my visitors?

No. It sets no cookies, writes nothing to browser storage, loads no analytics and needs no key. It makes one request for the data file and then answers every lookup inside the visitor's browser.

### Which area codes does it cover?

It covers the 427 geographic area codes in service for the United States and Canada in the NANPA report dated 2026-10-17. For each code it shows the state or province, the country and the other codes assigned to the same region.

### Can I put more than one widget on a page?

Yes. Add one div for each widget and load the script once. The data file is requested a single time and shared by every widget on the page.

### Will my site's styles break the widget, or the widget break my site?

Neither. The widget draws inside its own isolated style scope, so your CSS does not reach it and its CSS does not leak out. It adds no global styles and only one global name, LookValidAreaCode.

### How current is the data, and how do I get updates?

The file carries the date of the NANPA report it was built from (2026-10-17). The script loads the file from lookvalid.com each time, so a refreshed file reaches every embed without any change on your page.

## Related

- [US and Canadian area codes by state and province](https://lookvalid.com/area-code.md)
