How to Use dns.google: A Complete Guide to Google Public DNS, DNS Lookups and API Integration

s
sfweb
Nov 28, 2026
21 min read

DNS is one of the most important components of the internet, yet it is often overlooked until something stops working. Whether you are deploying a new website, migrating a server, configuring business email, verifying a domain, or developing an application, understanding how to troubleshoot DNS can save you hours of unnecessary debugging.

One of the most useful free tools available to developers and system administrators is dns.google, Google's public DNS lookup interface.

Beyond its simple web interface, Google Public DNS provides a powerful API that allows developers to retrieve DNS records programmatically, automate infrastructure monitoring, and build DNS diagnostics directly into web applications, SaaS platforms, and AI agents.

In this guide, we will explore how dns.google works, how to use its different features, and how to integrate it into your own applications.

What Is dns.google?

dns.google is the official web interface for Google Public DNS, a free recursive DNS resolution service operated by Google.

The Domain Name System (DNS) translates human-readable domain names into information that computers use to communicate, including IP addresses, mail server addresses, and other service configuration records.

For example, when you visit sfweb.ca, your browser needs to determine which IP address is associated with the domain before establishing a connection.

Google Public DNS allows you to perform these lookups using a web browser, command-line tools, or an HTTPS API.

Google Public DNS supports the following resolver addresses:

Protocol Primary DNS Secondary DNS
IPv4 8.8.8.8 8.8.4.4
IPv6 2001:4860:4860::8888 2001:4860:4860::8844

It also supports encrypted DNS protocols:

Unlike traditional DNS hosting providers, Google Public DNS is a recursive resolver. It allows you to retrieve DNS records but does not allow you to create or manage DNS records for your domain.

How Does Google Public DNS Work?

When a DNS resolver receives a request for a domain name, it first checks whether a valid response is already available in its cache.

If the requested record is not cached, the resolver may need to query multiple DNS servers to obtain the answer.

A simplified DNS resolution process looks like this:

  1. A browser or application requests the IP address of a domain.

  2. Google Public DNS checks its cache.

  3. If necessary, it contacts a DNS root server.

  4. The root server directs it to the appropriate top-level domain (TLD) name servers, such as .com or .ca.

  5. The TLD name server identifies the domain's authoritative name servers.

  6. The authoritative name server returns the requested DNS record.

  7. Google Public DNS caches the response and returns it to the requesting application.

Caching reduces unnecessary DNS requests and improves resolution efficiency.

The duration for which a DNS record can normally remain cached is determined by its TTL (Time to Live).

How to Use dns.google to Look Up DNS Records

You do not need to install any software, create an account, or change your computer's DNS settings to use the Google DNS lookup tool.

Follow these steps:

  1. Open https://dns.google.

  2. Enter the domain name or IP address you want to investigate.

  3. Click Resolve.

  4. Enter the desired DNS record type on the results page.

  5. Review the returned records, TTL values, and diagnostic information.

For example, you can perform a DNS lookup for SFWeb using the following URL:

https://dns.google/resolve?name=sfweb.ca&type=A

This request returns a JSON response containing the domain's IPv4 address records, if available.

This is particularly useful when configuring a new website, troubleshooting a hosting migration, or checking whether changes made through a DNS provider such as Cloudflare are visible through Google's resolver.

If you are currently configuring a web server, we also recommend reading our guide on installing a LAMP stack on Ubuntu Server 24.04.

Understanding the Different DNS Record Types

Google Public DNS supports a wide range of DNS record types. Understanding their purpose is essential when troubleshooting websites, email servers, and application infrastructure.

Record type DNS type number Purpose
A 1 Maps a domain to an IPv4 address
AAAA 28 Maps a domain to an IPv6 address
CNAME 5 Creates an alias pointing to another hostname
MX 15 Specifies mail servers responsible for receiving email
TXT 16 Stores text-based information, including SPF and domain verification records
NS 2 Identifies authoritative name servers
SOA 6 Contains administrative information about a DNS zone
PTR 12 Supports reverse DNS lookups
SRV 33 Specifies the location and port of a network service
CAA 257 Specifies which certificate authorities may issue certificates
DS 43 Connects DNSSEC trust between parent and child zones
DNSKEY 48 Contains public keys used for DNSSEC validation
HTTPS 65 Provides information about HTTPS service endpoints and capabilities

Rather than using an ANY query to retrieve every DNS record, query each record type individually. An ANY request is not guaranteed to return all records associated with a domain.

Checking a website's IP address

To retrieve the IPv4 addresses associated with a domain:

https://dns.google/resolve?name=example.com&type=A

To retrieve IPv6 addresses:

https://dns.google/resolve?name=example.com&type=AAAA

Checking mail servers

To determine which servers are responsible for receiving email for a domain:

https://dns.google/resolve?name=example.com&type=MX

MX records contain a priority value and a mail server hostname. Lower priority numbers generally indicate preferred mail servers.

Checking SPF, DKIM and DMARC records

DNS plays an essential role in email authentication and deliverability.

SPF records can be retrieved using:

https://dns.google/resolve?name=example.com&type=TXT

DMARC records can be retrieved using:

https://dns.google/resolve?name=_dmarc.example.com&type=TXT

DKIM records can be retrieved using a domain's configured DKIM selector:

https://dns.google/resolve?name=selector1._domainkey.example.com&type=TXT

Replace selector1 with the actual selector used by your email provider. Some providers use CNAME records to delegate DKIM configuration.

These lookups are particularly useful when configuring a self-hosted mail server, troubleshooting email authentication failures, or investigating why business emails are being rejected.

However, the presence of these records does not guarantee successful email delivery. SMTP configuration, IP reputation, message authentication, and recipient filtering policies must also be considered.

If your business is experiencing email or infrastructure configuration problems, our IT services and server management solutions can help identify and resolve the underlying issues.

How to Use the Google DNS Lookup API

One of the most powerful features of dns.google is its JSON-based DNS-over-HTTPS API.

Developers can perform DNS lookups using standard HTTP GET requests without implementing a traditional DNS protocol client.

The API endpoint is:

https://dns.google/resolve

No API key or Google Cloud account is required for ordinary public DNS queries.

Supported API parameters

Parameter Description Example
name Domain or DNS name to resolve example.com
type DNS record type MX
cd Disables DNSSEC validation when enabled 0 or 1
do Requests additional DNSSEC records 0 or 1
edns_client_subnet Controls subnet information used for location-aware resolution 0.0.0.0/0
random_padding Adds optional request padding abc123

The name parameter is required. If no record type is specified, the API defaults to an A record lookup.

Example JSON response

A simplified, illustrative DNS response might look like this:

{
    "Status": 0,
    "TC": false,
    "RD": true,
    "RA": true,
    "AD": false,
    "CD": false,
    "Question": [
        {
            "name": "example.com.",
            "type": 1
        }
    ],
    "Answer": [
        {
            "name": "example.com.",
            "type": 1,
            "TTL": 300,
            "data": "192.0.2.10"
        }
    ]
}

The IP address above is reserved for documentation purposes. Actual DNS responses will depend on the queried domain and its configuration.

The most important response fields are:

  • Status: The DNS response code.

  • Question: Information about the requested DNS lookup.

  • Answer: The returned DNS records, when available.

  • TTL: The remaining cache lifetime, expressed in seconds.

  • Data: The actual value associated with each record.

  • AD: Indicates whether the resolver has authenticated the response through DNSSEC.

  • CD: Indicates whether DNSSEC checking was disabled.

  • TC: Indicates whether the DNS response was truncated.

Understanding DNS response codes

Status Name Meaning
0 NOERROR The query completed without a DNS protocol error
1 FORMERR The DNS query was malformed
2 SERVFAIL The resolver could not complete the lookup
3 NXDOMAIN The requested DNS name does not exist
4 NOTIMP The requested operation is not implemented
5 REFUSED The DNS server refused the operation

An important distinction is that a Status value of 0 does not necessarily mean that the requested record exists. A successful DNS query may return no Answer records when the name exists but the requested record type does not.

Applications should also distinguish between HTTP errors and DNS response codes. An HTTP 200 response can still contain a DNS Status of 2 or 3.

How to Use Google DNS from the Linux Command Line

Developers and system administrators can query Google Public DNS directly from a Linux terminal.

On Ubuntu or Debian, install the required utilities:

sudo apt update
sudo apt install dnsutils curl jq -y

Using cURL

Retrieve A records:

curl -sS 'https://dns.google/resolve?name=sfweb.ca&type=A'

Format the JSON response using jq:

curl -sS 'https://dns.google/resolve?name=sfweb.ca&type=A' | jq

Retrieve MX records:

curl -sS 'https://dns.google/resolve?name=sfweb.ca&type=MX' | jq

Extract only IPv4 addresses from a successful response:

curl -fsS 'https://dns.google/resolve?name=sfweb.ca&type=A' \
  | jq -r '.Answer[]? | select(.type == 1) | .data'

This approach is particularly useful when building shell scripts, deployment pipelines, or infrastructure monitoring systems.

Using dig

The dig command communicates with DNS servers directly and provides detailed information about DNS responses.

Query Google Public DNS:

dig @8.8.8.8 sfweb.ca A

Retrieve mail servers:

dig @8.8.8.8 sfweb.ca MX

Retrieve authoritative name servers:

dig @8.8.8.8 sfweb.ca NS

Return a shorter response:

dig @8.8.8.8 sfweb.ca A +short

Perform a reverse DNS lookup:

dig @8.8.8.8 -x 8.8.8.8

Trace the DNS delegation hierarchy:

dig +trace sfweb.ca

Unlike a standard Google Public DNS query, dig +trace performs iterative lookups through the DNS hierarchy.

For developers managing Ubuntu infrastructure, we also recommend our guide on securing Ubuntu Server SSH with Fail2Ban and UFW.

How to Integrate Google DNS API into PHP

The JSON API makes it easy to build DNS lookup functionality into native PHP applications without requiring external SDKs or Composer packages.

The following example uses PHP 8 and the cURL extension.

Install PHP cURL if necessary:

sudo apt install php-curl -y

Create a PHP function that retrieves DNS records:

<?php

function lookupDNS(string $domain, string $type = 'A'): array
{
    $type = strtoupper($type);

    $allowedTypes = [
        'A', 'AAAA', 'MX', 'TXT', 'CNAME',
        'NS', 'SOA', 'PTR', 'CAA',
        'SRV', 'DS', 'DNSKEY', 'HTTPS'
    ];

    if (!in_array($type, $allowedTypes, true)) {
        throw new InvalidArgumentException(
            'Unsupported DNS record type.'
        );
    }

    $url = 'https://dns.google/resolve?' . http_build_query([
        'name' => $domain,
        'type' => $type,
        'edns_client_subnet' => '0.0.0.0/0'
    ], '', '&', PHP_QUERY_RFC3986);

    $ch = curl_init($url);

    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CONNECTTIMEOUT => 3,
        CURLOPT_TIMEOUT => 10,
        CURLOPT_FOLLOWLOCATION => false,
        CURLOPT_SSL_VERIFYPEER => true,
        CURLOPT_SSL_VERIFYHOST => 2,
        CURLOPT_HTTPHEADER => [
            'Accept: application/json'
        ]
    ]);

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);

    curl_close($ch);

    if ($response === false || $httpCode !== 200) {
        throw new RuntimeException(
            'DNS API request failed: ' . $error
        );
    }

    return json_decode(
        $response,
        true,
        512,
        JSON_THROW_ON_ERROR
    );
}

try {
    $result = lookupDNS('sfweb.ca', 'A');

    if (($result['Status'] ?? -1) !== 0) {
        throw new RuntimeException(
            'DNS resolution failed with status: '
            . ($result['Status'] ?? 'unknown')
        );
    }

    print_r($result['Answer'] ?? []);

} catch (Throwable $e) {
    echo $e->getMessage();
}

This function can be integrated into applications that require:

  • Domain ownership verification.

  • Website infrastructure monitoring.

  • Email server configuration checks.

  • SaaS custom domain validation.

  • Automated deployment verification.

  • DNS record change detection.

  • Domain diagnostics for AI agents.

For production environments, developers should also implement input validation, request limits, TTL-aware caching, retry policies, and appropriate error logging.

If your business requires a custom API, backend application, or integration with existing software, explore our API development and integration services and custom web development services.

How to Use Google DNS API with JavaScript

Google's JSON API can also be used in JavaScript environments.

The following example demonstrates an asynchronous DNS lookup using the Fetch API:

async function lookupDNS(domain, type = 'A') {
    const params = new URLSearchParams({
        name: domain,
        type: type,
        edns_client_subnet: '0.0.0.0/0'
    });

    const response = await fetch(
        `https://dns.google/resolve?${params}`,
        {
            headers: {
                Accept: 'application/json'
            },
            signal: AbortSignal.timeout(10000)
        }
    );

    if (!response.ok) {
        throw new Error(
            `HTTP error: ${response.status}`
        );
    }

    const result = await response.json();

    if (result.Status !== 0) {
        throw new Error(
            `DNS error: ${result.Status}`
        );
    }

    return result.Answer ?? [];
}

lookupDNS('sfweb.ca', 'MX')
    .then(records => console.log(records))
    .catch(error => console.error(error));

This is useful for building interactive DNS lookup tools, browser-based dashboards, Node.js applications, and domain management interfaces.

For applications requiring centralized caching, logging, access control, and predictable request volumes, consider routing DNS queries through your own backend API.

How to Flush Google Public DNS Cache

When you update a DNS record, some users may continue receiving the previous value until their resolver's cached record expires.

This frequently occurs during:

  • Website hosting migrations.

  • Server IP address changes.

  • Domain registrar transfers.

  • Name server changes.

  • Email server migrations.

  • CDN and reverse proxy configuration updates.

Google provides a dedicated tool that allows users to request the removal of cached DNS information.

Visit:

https://dns.google/cache

To flush a DNS record:

  1. Enter the domain name.

  2. Select the relevant DNS record type.

  3. Complete the verification process if required.

  4. Submit the cache flush request.

  5. Perform another DNS lookup to verify the updated record.

If you recently changed your domain's registrar or authoritative DNS provider, Google recommends flushing the main domain before flushing individual subdomains.

Important: Flushing Google Public DNS cache does not flush DNS caches across the entire internet. Internet service providers, other public resolvers, operating systems, and browsers may still retain previously cached information.

How to Check DNS Propagation Using Multiple Resolvers

When migrating a website or changing DNS records, checking only one resolver is not always sufficient.

You can compare results from several public DNS providers:

# Google Public DNS
dig @8.8.8.8 sfweb.ca A +short

# Cloudflare DNS
dig @1.1.1.1 sfweb.ca A +short

# Quad9 DNS
dig @9.9.9.9 sfweb.ca A +short

# Default system resolver
dig sfweb.ca A +short

If these resolvers return different results after a DNS update, some of them may still have cached records.

However, different responses are not necessarily an error. CDNs, geographic load balancing, and DNS traffic management systems may intentionally return different IP addresses.

For a more reliable diagnosis, identify the authoritative name servers:

dig sfweb.ca NS +short

Then query one of the returned authoritative name servers directly:

dig @your-authoritative-nameserver sfweb.ca A

Replace your-authoritative-nameserver with the actual hostname returned by the NS lookup.

Comparing authoritative DNS records with recursive resolver responses helps determine whether a problem originates from the DNS configuration itself or from cached information.

Troubleshooting DNSSEC Errors with dns.google

DNSSEC (Domain Name System Security Extensions) provides cryptographic authentication for DNS records, helping protect against manipulated DNS responses.

A misconfigured DNSSEC deployment can prevent validating DNS resolvers from resolving an otherwise correctly configured domain.

Common causes include:

  • Expired DNSSEC signatures.

  • Incorrect DS records at the domain registrar.

  • Missing DNSKEY records.

  • Mismatched signing keys.

  • Incorrect DNSSEC configuration after a DNS provider migration.

To perform a standard DNSSEC-validating lookup:

curl -sS 'https://dns.google/resolve?name=example.com&type=A&cd=0' | jq

To perform a diagnostic lookup with DNSSEC validation disabled:

curl -sS 'https://dns.google/resolve?name=example.com&type=A&cd=1' | jq

If the first query returns SERVFAIL while the second returns valid records, a DNSSEC configuration problem may be responsible.

You can also retrieve DS and DNSKEY records:

dig @8.8.8.8 example.com DS +dnssec

dig @8.8.8.8 example.com DNSKEY +dnssec

Disabling DNSSEC validation should only be used for troubleshooting. It is not a permanent solution to a broken DNSSEC configuration.

For additional diagnostics, developers can use tools such as DNSViz to analyze the DNSSEC chain of trust.

DNS over HTTPS vs. Traditional DNS

Traditional DNS generally uses UDP or TCP on port 53. These requests are normally transmitted without encryption.

DNS over HTTPS encrypts DNS communication between the client and the recursive resolver using HTTPS.

Feature Traditional DNS DNS over HTTPS DNS over TLS
Default port 53 443 853
Encrypted transport No Yes Yes
Transport UDP/TCP HTTPS TLS over TCP
DNSSEC support Yes Yes Yes
HTTP API integration No Yes No

Google provides two different DNS-over-HTTPS interfaces:

  • /resolve: A convenient JSON-based API using HTTP GET requests.

  • /dns-query: A standards-based DNS-over-HTTPS endpoint implementing RFC 8484 and supporting GET and POST requests using DNS wire-format messages.

The JSON endpoint is particularly convenient for web applications and automation systems, while the standards-based endpoint is more appropriate for implementing general-purpose DNS clients.

Although encrypted DNS improves transport privacy, it does not make browsing anonymous. The DNS resolver can still process your queries, and other network information may reveal which services you access.

Using Google DNS for Automation and AI Agents

DNS lookups do not need to be performed manually. Developers can integrate DNS resolution directly into automated workflows that continuously monitor or validate internet infrastructure.

Some practical applications include:

Automated domain monitoring

Build a scheduled task that regularly checks A, AAAA, NS and MX records, compares them with previously stored values, and generates notifications when unexpected changes occur.

SaaS custom domain verification

Allow customers to connect their own domains to your SaaS application by verifying CNAME or TXT records automatically before activating their domain.

Email infrastructure diagnostics

Build a diagnostic tool that checks MX, SPF, DKIM, DMARC and reverse DNS records, then combines the results with additional SMTP and email authentication tests.

AI-powered infrastructure troubleshooting

Give AI agents access to structured DNS information so they can investigate website availability, detect configuration inconsistencies, and recommend troubleshooting steps based on actual network data.

Automated deployment verification

Integrate DNS checks into deployment pipelines to verify that domains point to the expected infrastructure before completing a website migration or production release.

DNS monitoring with n8n

You can create a simple automated DNS monitoring workflow using n8n:

  1. Add a Schedule Trigger node.

  2. Add an HTTP Request node.

  3. Set the request method to GET.

  4. Set the endpoint to https://dns.google/resolve.

  5. Add the name and type query parameters.

  6. Compare the returned records with previously stored values.

  7. Send a Telegram, Slack, or email notification when an unexpected change is detected.

If you want to deploy your own automation infrastructure, read our guide on setting up n8n with Docker on Ubuntu Server 24.04.

At SFWeb, we also build custom business automation solutions that connect APIs, monitoring systems, databases, notifications, and business applications.

How DNS Configuration Affects Technical SEO

DNS is not usually the first thing business owners consider when improving their search engine rankings. However, reliable DNS infrastructure is essential for website accessibility and search engine crawling.

If Googlebot cannot resolve your domain, it cannot retrieve your website's content.

Persistent DNS failures can cause search engines to reduce crawling and eventually remove inaccessible pages from their indexes.

Common DNS-related technical SEO problems include:

  • Incorrect A or AAAA records pointing to unavailable infrastructure.

  • Broken name server delegation.

  • DNSSEC validation failures.

  • Misconfigured www subdomains.

  • Unreliable authoritative DNS servers.

  • Incorrect DNS settings following a website migration.

  • Broken domain verification records for Google Search Console.

Changing your DNS resolver to Google Public DNS does not directly improve your website's search rankings. The objective is to maintain reliable, accessible, and correctly configured infrastructure.

Businesses should monitor DNS availability alongside website performance, HTTPS configuration, server uptime, crawl errors, and indexing reports.

Our technical SEO and local SEO services help Canadian businesses identify infrastructure and website issues that may negatively affect search visibility.

Common DNS Mistakes to Avoid

When configuring DNS for websites and applications, avoid the following mistakes:

  • Checking only A records: Incorrect AAAA records may cause connectivity problems for IPv6 users.

  • Forgetting email records during migrations: Moving website hosting should not unintentionally disrupt business email.

  • Using unnecessarily high TTL values during migrations: Lower relevant TTL values sufficiently in advance of planned infrastructure changes.

  • Assuming DNS propagation always takes 48 hours: Cache expiration depends on existing TTL values, delegation information, and resolver behavior.

  • Ignoring DNSSEC configuration: Stale DS records can make an entire domain unavailable through validating resolvers.

  • Expecting a CDN to expose the origin server's IP address: Proxied DNS records may intentionally return CDN addresses.

  • Treating HTTP success as DNS success: Always inspect the DNS Status field when using the JSON API.

  • Ignoring API request management: Public DNS services are subject to operational limits and should not be treated as unlimited infrastructure.

  • Assuming DNS resolution means a website is operational: A valid DNS response does not guarantee that HTTP, HTTPS, or other application services are functioning.

DNS Troubleshooting Checklist

Before investigating application code or reinstalling server software, verify the following:

  • The domain registration is active.

  • Authoritative name servers are correctly configured.

  • A and AAAA records point to the intended infrastructure.

  • CNAME records resolve correctly.

  • MX records point to the correct mail servers.

  • SPF, DKIM and DMARC records are correctly configured.

  • DNSSEC records are valid when DNSSEC is enabled.

  • Multiple recursive resolvers return expected results.

  • DNS TTL values are appropriate for your infrastructure.

  • HTTPS certificates are valid.

  • The destination server is reachable and responding.

This checklist is especially useful when deploying new web applications, migrating business websites, or investigating unexpected production downtime.

Frequently Asked Questions

Is dns.google free to use?

Yes. Google Public DNS and its public DNS lookup interfaces are free to use. High-volume applications should consider Google's usage limits and implement appropriate caching and request management.

Do I need an API key to use the Google DNS API?

No. Ordinary requests to the dns.google JSON API do not require an API key, authentication token, or Google Cloud account.

Can I manage my domain's DNS records through dns.google?

No. Google Public DNS is a recursive resolver, not a DNS hosting management platform. DNS records must be modified through your authoritative DNS hosting provider.

Is dns.google the same as 8.8.8.8?

Both are associated with Google Public DNS. However, dns.google provides web-based and encrypted DNS interfaces, while 8.8.8.8 is one of Google's public DNS resolver IP addresses.

Can dns.google check DNS propagation worldwide?

Not directly. It shows DNS information available through Google's resolver infrastructure. For broader propagation testing, compare multiple resolvers and geographically distributed monitoring locations.

Can I use Google DNS API in a commercial application?

Google Public DNS can be integrated into commercial applications, subject to applicable usage policies and operational limits. Production applications should implement caching, error handling, and resilience against external service outages.

Can Google DNS verify whether an email address exists?

No. DNS can help determine whether a domain exists and how its email infrastructure is configured, but it cannot reliably confirm whether a specific mailbox exists.

Can DNS problems affect Google Search rankings?

Persistent DNS failures can prevent search engines from crawling and indexing your website. Maintaining reliable DNS infrastructure helps protect your website's accessibility and organic search visibility.

Is DNS over HTTPS completely private?

No. DNS over HTTPS encrypts communication between the client and the DNS resolver, but it does not hide all internet activity or provide complete anonymity.

Useful Resources and Official Documentation

Conclusion

Google Public DNS is much more than an alternative to your internet provider's DNS servers. Its web interface, encrypted DNS protocols, and JSON API make it a valuable tool for developers, system administrators, business owners, and anyone managing internet infrastructure.

From troubleshooting a website migration to building automated domain verification systems, dns.google provides a simple and accessible way to retrieve structured DNS information without installing additional software.

By combining DNS lookups with PHP, JavaScript, Linux utilities, automation platforms, and AI agents, developers can build powerful infrastructure monitoring and diagnostic tools.

Need Help with DNS, Web Development or Server Infrastructure?

At SFWeb, we help businesses across Canada build, deploy, secure, and maintain reliable digital infrastructure.

Our services include:

Whether you operate a small business in Montreal, a growing startup in Toronto, or an established company anywhere in Canada, we can help simplify your technical infrastructure.

Contact SFWeb today to discuss your project and discover how we can help your business build a more reliable, secure, and scalable online presence.