chrome.dns

Description

Use thechrome.dns API for dns resolution.

Permissions

dns

Availability

Dev channel

To use this API, you must declare the"dns" permission in themanifest.

{"name":"My extension",..."permissions":["dns"],...}
Note: This API is only available inChrome Dev. There are no foreseeable plans to move this API from the dev channel into Chrome stable.

Usage

The following code callsresolve() to retrieve the IP address ofexample.com.

service-worker.js:

constresolveDNS=async()=>{letrecord=awaitchrome.dns.resolve('example.com');console.log(record.address);// "192.0.2.172"};resolveDNS();
Key point: Do not include the scheme or trailing slash in the hostname. For example,https://example.com/ is invalid.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-11 UTC.