This post contains affiliate links. As a partner with Amazon and various brands, I am compensated when qualifying purchases are made through my referral links.
Whether you sell ad inventory through AdSense or any other network, you should use an ads.txt file.

Selling ad inventory through a network like Google AdSense is an easy way to monetize your website’s traffic.
MACHINE LEARNING FOR PUBLISHERS
Whatever your goals are—increase revenue, balance UX, improve site speed, streamline growth—accomplish them with Ezoic.
Table of contents
You don’t have to negotiate contracts with advertisers, nor do you have to upload their creatives manually.
Instead, the ad network will handle all the legwork while you sit back and earn revenue for impressions and clicks.
While most ad networks don’t require them, this otherwise simple file can increase your website’s earning potential.
What Is an Ads.txt File
Standardized by the Interactive Advertising Bureau (IAB) in 2017, an ads.txt file is a plain-text file that contains the domains of the ad networks with which a publisher’s website is monetized and the corresponding account IDs for those ad networks.
It also specifies whether the publisher or a third-party agency manages the ad network accounts.
Each line of an ads.txt file must contain three comma-separated elements: the ad network’s domain, the account ID associated with the AD network, and either “DIRECT” or “RESELLER.”
If you sell ad inventory exclusively through Google AdSense, for instance, your website’s ads.txt file should like:
google.com, pub-1234567890123456, DIRECT
The “DIRECT” element indicates that you manage the AdSense account from which your website serves ads yourself.
If you display ads from the Google account of a third-party agency, you should change this element to “RESELLER.”
You can include multiple ad networks in your website’s ads.txt file. Just place each ad network on a separate line.
When you are finished, save and upload the ads.txt file to your website’s domain’s root folder.
You can also use a WordPress Plugin such as Advanced Ads.
Manage Ads in WordPress
Ad rotation based on customizable ad weight enabling split tests and multiple advertisers per ad space.
Why You Should Use an Ads.txt File
Using an ads.txt file can increase your website’s earnings by verifying its identity to advertisers.
It’s designed to protect against domain spoofing on ad networks by showing which networks and accounts are allowed to sell your website’s ad inventory.
With an ads.txt file in place, advertisers will feel more confident buying inventory on your website, knowing that their ads will appear on your site rather than a spoofed domain.
Also known as Domain Name Server (DNS) spoofing, domain spoofing occurs when a website tricks crawlers or users into thinking it has a different domain.
Nefarious publishers use it to deceive advertisers into paying more for their ad inventory. If a publisher’s website generates little or no traffic, he or she may spoof the domain to show a more popular site.
As a result, advertisers will think they are buying inventory from a popular website when they are actually buying inventory from a completely different site with less or lower-quality traffic.
If you don’t create an ads.txt file, advertisers may be reluctant to buy your website’s inventory. Another publisher could spoof your website’s domain, in which case advertisers will end up paying for lower-quality traffic that doesn’t convert well.
An ads.txt file gives advertisers the option to purchase authorized ad inventory.
Advertisers who want to avoid the headache of purchasing fraudulent inventory from a spoofed domain can target your website’s authorized inventory as specified in its ads.txt file.
MACHINE LEARNING FOR PUBLISHERS
Whatever your goals are—increase revenue, balance UX, improve site speed, streamline growth—accomplish them with Ezoic.
How an Ads.txt File Works
An ads.txt works by creating a record of the ad networks and account IDs that are authorized to sell your website’s ad inventory.
Once uploaded to the root folder of your website’s domain, the ad networks used by your website will crawl it.
Dozens of ad networks support ads.txt files.
They’ll scan publishers’ websites in search of this file. If located, ad networks will offer the website’s authorized inventory to advertisers.
Since other publishers can’t modify your website’s ads.txt file, it provides advertisers with peace of mind knowing their ads will appear on your site.
When advertisers see your website is selling authorized inventory that’s protected against domain spoofing, they may pay more for it.
Creating an Ads.txt File: What You Should Know
You don’t need any special software to create an ads.txt file. All it takes is Notepad, or if you’re a Mac user, TextEdit.
Just enter an ad network’s domain, the corresponding account ID, and “DIRECT” or “RESELLER” on each line. Save the file as “ads.txt” while retaining its plain-text format and then upload it to your domain’s root folder.
While optional, ads.txt files support comments as well. Comments, of course, are used for reference purposes. To add a comment, create a new line beginning with the pound sign, after which you can enter your comment on the same line.
When they encounter the pound sign, ad networks will ignore all proceeding text.
You can use comments to make notes about the ad networks and account IDs listed in your website’s ads.txt file.
It’s a good idea to validate your ads.txt file to ensure it’s free of errors.
Because the ads.txt file uses a standardized format, you must create it in a specific way. Failure to include a comma after an ad network’s domain, for example, will prevent that network from registering it.
To validate your ads.txt file, go to adstxtvalidator.com and use the free validator tool.
It will display the file’s records while highlighting any lines that contain errors or warnings.
An error indicates a severe flaw in formatting, whereas a warning indicates a less-severe problem like an unknown ad network domain.
Of course, an ads.txt file is only useful for protecting against domain spoofing if you keep it out of the hands of nefarious publishers.
If another publisher can access it, they may change the ad networks and account IDs to reflect a spoofed domain.
Therefore, you should create strong passwords for your website’s cPanel and File-Transfer Protocol (FTP) accounts while also changing these passwords regularly.
According to Invesp, $1 out of every $3 advertisers spend on digital ads involves a fraudulent placement. You can ease advertisers’ worries, though, by using an ads.txt file.
It allows advertisers to purchase authorized ad inventory from your website that’s free of domain spoofing or similar fraudulent activities.