SEO Tools 11 min readBy Mehadi ShawonPublished Updated

How to Find Your AdSense Publisher ID in 30 Seconds (2026)

Find your Google AdSense publisher ID (pub-XXXXXXXXXXXXXXXX) on desktop or mobile, and copy the exact ads.txt line — with fixes for every common error.

Glowing golden ID card with publisher identifier code above an AdSense dashboard on a laptop
Quick answer

How to Find Your AdSense Publisher ID in 30 Seconds (2026)

Your Google AdSense Publisher ID lives in Account → Settings → Account Information inside your AdSense dashboard. It starts with 'pub-' followed by 16 digits and is the exact value you paste into your ads.txt file and AdSense code snippet.

Every AdSense article assumes you already know your pub- ID. Most people don't. Here's the exact path on desktop and mobile, the three places you'll actually use it, the ads.txt line you can copy verbatim, and fixes for every error Google is likely to throw at you.

Table of Contents

  • What a publisher ID actually is
  • The exact path (desktop)
  • Finding it on mobile
  • Finding it without logging in
  • pub- vs ca-pub- vs customer ID
  • Where you'll use it
  • Your ads.txt line, copy-ready
  • Common mistakes
  • Error messages and fixes
  • Verify your setup
  • FAQ
Glowing golden ID card with publisher identifier code above an AdSense dashboard on a laptop

What a Publisher ID Actually Is

A publisher ID is the unique account number Google assigns to your AdSense account the moment it is created. It looks like pub-1234567890123456: the literal prefix 'pub-' followed by exactly 16 digits. Every ad request from your site carries this ID, which is how Google knows which account to credit for an impression or click.

Because it is an account identifier rather than a secret, it is intentionally visible in your page source and your ads.txt file. What matters is that the ID published on your site matches the account that should be paid — a mismatch is the single most common reason earnings appear to vanish after a theme change or site migration.

The Exact Path

  1. Sign in at adsense.google.com.
  2. In the left menu, click Account.
  3. Click Settings → Account Information.
  4. Your Publisher ID is the value labelled 'Publisher ID', formatted pub-XXXXXXXXXXXXXXXX.
  5. Click the copy icon next to it rather than selecting the text by hand — manual selection is where stray spaces come from.

If the Settings menu isn't there

A brand-new account under review shows a reduced menu. The ID already exists, but Google hides account settings until the site review completes. If your dashboard shows 'We're reviewing your site', wait for the review or use the view-source method below — ad code you already installed contains the ID.

Finding It on Mobile

  1. Open adsense.google.com in Chrome or Safari (not the AdSense app — it no longer shows account settings).
  2. Tap the hamburger menu in the top-left corner.
  3. Tap Account, then Settings, then Account Information.
  4. If the menu looks truncated, use the browser's 'Request desktop site' option.

Finding It Without Logging In

If AdSense code is already live on your site, you never need the dashboard:

  1. Open any page of your site and view the page source (Ctrl+U, or Cmd+Option+U on macOS).
  2. Search the source for 'ca-pub-'.
  3. The 16 digits following that prefix are your publisher ID.
  4. Alternatively open https://yourdomain.com/ads.txt — if the file exists, the pub- value is right there.

pub- vs ca-pub- vs Customer ID

Three similar-looking identifiers get confused constantly, and using the wrong one silently breaks monetisation:

  • pub-1234567890123456 — your AdSense publisher ID. This exact form goes in ads.txt.
  • ca-pub-1234567890123456 — the same ID with a client-account prefix. This form goes in the data-ad-client attribute and the adsbygoogle.js script URL.
  • 123-456-7890 — your Google Ads customer ID. This belongs to the advertiser side and never appears in AdSense setup.

Where You'll Use It

  • In ads.txt at your site root: google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
  • Inside the AdSense auto-ads script (the data-ad-client attribute).
  • Anywhere a third-party platform (Shopify, Ghost, etc.) asks for your AdSense account ID.
  • In Google Ad Manager or a mediation partner's dashboard when you authorise them to sell your inventory.

Your ads.txt Line, Copy-Ready

A single line is enough for a site monetised only by AdSense. Replace the digits with your own ID, keep everything else byte-for-byte identical, and save the file as plain UTF-8 text at the domain root:

google.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0

The four fields are the ad system's domain, your publisher ID, your relationship to that system (DIRECT because you own the account), and Google's certification authority ID, which is the same constant for every AdSense publisher. If you also run Ad Exchange or a mediation partner, add one line per partner rather than editing this one.

Ad Space

Common Mistakes

  • Copying with leading or trailing spaces — ads.txt parsers will reject it.
  • Using your Google Ads customer ID (XXX-XXX-XXXX) instead of your AdSense pub- ID.
  • Placing ads.txt anywhere other than the domain root.
  • Writing ca-pub- inside ads.txt — the ca- prefix belongs only in ad code.
  • Saving ads.txt as .txt.html or with a UTF-8 byte-order mark from Notepad, which makes the first line unparseable.
  • Serving ads.txt through a redirect chain — Google follows only one redirect, and only within the same root domain.
  • Reusing a tutorial's example ID (a surprisingly frequent copy-paste error that credits someone else's account).

Error Messages and Fixes

'Earnings at risk — ads.txt file not found'

Google's crawler got a non-200 response. Load https://yourdomain.com/ads.txt in a private window: if you see your site's 404 page or a redirect to the homepage, the file isn't being served from the root. On static hosts put it in the public/ directory; on WordPress use the Ads.txt Manager plugin instead of editing theme files.

'Unauthorized' in the ads.txt status column

The file exists but the publisher ID in it doesn't match your account. Compare it character by character with the value in Account Information — transposed digits are the usual culprit.

Ads showing as blank space after a correct setup

Blank slots almost always mean the ad code carries a different client ID than the one authorised in ads.txt, or your account is still in the review window where Google serves no ads. Check both before touching layout code.

Verify Your Setup

After updating ads.txt, visit https://yourdomain.com/ads.txt directly in a browser and confirm the line shows up exactly as written. Google's ads.txt crawler re-checks within 24 hours.

Then check the AdSense dashboard: Sites → your domain shows the ads.txt status, and the warning banner disappears once the crawler validates the file. If it is still flagged after 48 hours, purge your CDN cache and confirm the response header content type is text/plain.

A Realistic Timeline

  1. Minute 0 — copy the publisher ID from Account Information.
  2. Minute 2 — publish ads.txt at the domain root and load the URL to confirm it renders as plain text.
  3. Hour 1–24 — Google's crawler fetches the file; the warning banner clears on its own.
  4. Day 2 — if the banner persists, purge caching layers and re-check the file's status code and content type.

Run a free SEO audit on your site to catch missing files like ads.txt.

Open SEO Analyzer

Not showing in search yet? Work through the 9 real causes.

Read the Indexing Guide

Frequently Asked Questions

Is my publisher ID different from my customer ID?+

Yes. The customer ID is for Google Ads (advertiser side). The publisher ID (pub-XXXXXXXX) is for AdSense (publisher side). Don't mix them in ads.txt.

What if I can't see Account Information in AdSense?+

Your account might be pending review or limited. Check the home dashboard for any warning banner — the Settings menu unlocks once your account is fully active.

Can I have more than one publisher ID?+

No. Each AdSense account has exactly one publisher ID, which covers all the sites you add to that account.

Why does Google say my ads.txt is invalid?+

Most often a typo in the publisher ID, or hosting ads.txt at /folder/ads.txt instead of the root. It must be at https://yourdomain.com/ads.txt.

What's the difference between pub- and ca-pub-?+

They're the same account. 'ca-pub-XXXXXXXXXXXXXXXX' is the client-account form used in the data-ad-client attribute and the adsbygoogle script URL; 'pub-XXXXXXXXXXXXXXXX' (no ca-) is the form used inside ads.txt. Never put ca- in ads.txt.

Can I find my publisher ID without logging into AdSense?+

Yes, if ad code is already live on your site: open any page, view source, and search for 'ca-pub-'. The 16 digits after it are your publisher ID. You can also check an existing /ads.txt file.

How do I find my publisher ID on the AdSense mobile app or phone browser?+

The AdSense app no longer exposes account settings, so open adsense.google.com in a mobile browser, tap the hamburger menu, then Account → Settings → Account Information. Request desktop site if the menu is truncated.

Does my publisher ID change if I change domains or add a site?+

No. The ID is tied to your AdSense account, not to a domain. Every site you add uses the same pub- ID, and it stays identical if you migrate domains.

Is it safe to publish my publisher ID?+

It has to be public — it appears in your ads.txt and in your page source, so anyone can read it. It cannot be used to sign into your account or withdraw earnings. Treat it as an identifier, not a credential, but never share your Google login or payment details.

Why does AdSense show 'Unauthorized' or 'Ads.txt file not found' even after I added the line?+

Three usual causes: the file is served with the wrong content type or behind a redirect, it sits at a subfolder instead of the domain root, or a CDN is still serving a cached 404. Purge the cache, confirm https://yourdomain.com/ads.txt returns plain text with a 200 status, then wait up to 24 hours for the crawler.

Do subdomains need their own ads.txt?+

Root-domain ads.txt covers the root and www. If you monetise a subdomain (blog.example.com) that has its own content, Google looks for ads.txt on that host too — publish the same line there.

What if I have several AdSense accounts?+

Google only permits one AdSense account per person, but if you legitimately manage accounts for clients, each account has its own pub- ID and each site's ads.txt must list the ID that actually monetises it.

Ad Space

Related articles

Browse all in SEO Tools

Try the related free tools

Hands-on utilities from DigiMetrics Hub that go with this guide.

All tools