Free auditStart free
GlossaryGlossary · Crawling

User agent

The User-Agent header names the software making a request. See real browser and Googlebot strings, how to find bots in your logs, and why it can be faked.

3 min
read
5
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

A user agent is the software making an HTTP request, and the User-Agent request header is the string that identifies it: application, operating system, vendor or version. Browsers and crawlers both send one. Because any client can send any value, a user-agent string alone never proves who a bot really is.

30-second check

Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Check it

What a user-agent string looks like

MDN defines the User-Agent request header as a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent. Browsers send a string that begins with Mozilla/5.0, and MDN's examples show crawler strings such as Googlebot's carry the same prefix.

Browsers now expose less detail in this string for privacy. MDN points developers who need specifics to User-Agent Client Hints, requested through the Accept-CH response header.

Real examples (from MDN)
# Chrome on desktop
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

# Googlebot
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
02Explained

Why it matters for SEO

Three jobs depend on the user agent. Your robots.txt file targets crawlers by name with the User-agent line. Your server logs record who fetched what, which is how you see Googlebot, Bingbot and AI crawlers hit your pages. And rules at the server or CDN can allow or block a bot by its string.

Do not serve different content to browsers and crawlers based on this header. MDN calls serving different content to different browsers by parsing the User-Agent usually a bad idea, and Google's spam policies define cloaking as presenting different content to users and search engines with the intent to manipulate rankings, including text inserted only when the requesting user agent is a search engine. Use responsive CSS and feature detection for layout instead.

03How it works

Find crawlers in your logs

In the default nginx and Apache combined log format, the user agent is the last quoted field. This command counts requests per user agent that mention "bot" or "crawler":
  1. 1

    Reverse DNS

    Run host <ip> on the address from your log. Google says to verify that the domain name is googlebot.com, google.com, or googleusercontent.com.

  2. 2

    Forward DNS

    Run host <hostname> and confirm it resolves back to the same IP.

  3. 3

    Or match published ranges

    Google publishes JSON files of crawler IP ranges in CIDR notation. Compare the request IP against them in code.

Count bot requests by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | grep -Ei 'bot|crawler' | sort | uniq -c | sort -rn | head -20

A string that says Googlebot is a claim, not proof. Google's documentation notes that spammers or other troublemakers might falsely claim to be Google, so verify the IP.

04Check it

Target a crawler in robots.txt

Each robots.txt group starts with a User-agent line naming the crawler it applies to. User-agent: * matches all crawlers except AdsBot, which must be named explicitly.

Robots.txt is voluntary. It only works for crawlers that respect it and is not a security mechanism. Google's robots.txt guide says that to keep information secure from crawlers, use other blocking methods, such as password-protecting private files on your server.

Block one crawler, allow everyone else
User-agent: GPTBot
Disallow: /

User-agent: *
Allow: /
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01Can a crawler fake its user agent?

Yes. The client chooses the value, so any bot can claim to be Googlebot or a browser. Verify claimed Google crawlers with reverse and forward DNS lookups or by matching Google's published IP ranges.

02How do I see my own browser's user agent?

Open DevTools, go to the Network tab, click any request and read the User-Agent request header. In the console, navigator.userAgent prints the same string.

03Should I serve different pages based on user agent?

Generally no. MDN says serving different content to different browsers is usually a bad idea. Use responsive design and feature detection, and give crawlers the same content as users.

04What is the Googlebot user agent?

One string MDN lists is Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html). Google's page on verifying Google requests explains how to confirm a request really comes from Google.

Sources · 5

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • mozilla.org
  • google.com
  1. 01User-Agent header - MDN Web Docsdeveloper.mozilla.org · checked 2026-10-24
  2. 02Browser detection using the user agent - MDN Web Docsdeveloper.mozilla.org · checked 2026-10-24
  3. 03Verifying Google crawler requests - Google Search Centraldevelopers.google.com · checked 2026-10-24
  4. 04How to write and submit a robots.txt file - Google Search Centraldevelopers.google.com · checked 2026-10-24
  5. 05Spam policies for Google web searchdevelopers.google.com · checked 2026-10-24
Free · 2 minutes

Know the term. Now check your site.

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly