# How do I whitelist or blacklist a domain?

**URL:** https://discourse.pi-hole.net/t/how-do-i-whitelist-or-blacklist-a-domain/244
**Category:** FAQs
**Tags:** whitelisting, blacklisting
**Created:** [October 18, 2016, 8:53pm UTC](https://discourse.pi-hole.net/t/how-do-i-whitelist-or-blacklist-a-domain/244 "2016-10-18T20:53:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![faq-bot](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/faq-bot/32/98_2.png) [@faq-bot](https://discourse.pi-hole.net/u/faq-bot)
#### Post date: [October 18, 2016, 8:53pm UTC](https://discourse.pi-hole.net/t/how-do-i-whitelist-or-blacklist-a-domain/244/1 "2016-10-18T20:53:40Z")

</div>

# Whitelisting And Blacklisting Is Different On Pi-hole

Whitelisting or blacklisting a site on the Pi-hole works differently than traditional ad-blockers. This is because the **Pi-hole works at the DNS level** , which should make more sense as you read on.

https://www.youtube.com/embed/J6_3RH4DK1A?feature=oembed&wmode=opaque

Let's say you want to whitelist pi-hole.net. With a normal ad blocker, you would just whitelist _that_ domain. But on the _Pi-hole_, you need to do a little investigation into the site you want to whitelist. Now pi-hole.net doesn't have ads, but imagine for a moment that it used Google Ads, which many other sites do. Since the ad images are hosted _by_ Google, you would need to whitelist Google to allow ads on pi-hole.net.

Now if you were to whitelist Google ads so they would show up on pi-hole.net, you would also be whitelisting them for every other site that uses Google ads. So while this can be extremely powerful for blacklisting (i.e. blacklisting a single domain, blocks ads on multiple sites), it can also be difficult to support the sites you want.

# Use A Plugin To Help

I suggest using the [Chrome extension Whitelist Assistant by DNSthingy](https://chrome.google.com/webstore/detail/whitelist-assistant-by-dn/fdmpekabnlekabjlimjkfmdjajnddgpc?hl=en) as it will do a lot of the work for you. Just load up a page and open the extension to see all the domains the current page is using.

So in the hypothetical situation of pi-hole.net displaying advertisements from Google, if one of Google's ad-serving domains is tpc.googlesyndication.com. So if you happened to whitelist pi-hole.net and not tpc.googlesyndication.com, ads would not appear because you did not whitelist the Google domain where the ads are being served from.

# Self-hosted Advertisements

Some sites like The Next Web host their own canvas ads, simply whitelisting thenextweb.com would be good enough since the files are hosted on the same domain.

# How To Actually Whitelist Or Blacklist A Domain

## On-demand

The easiest way is to just navigate to the Pi-hole dashboard and click Whitelist.

Alternatively, you can now whitelist Websites on demand by using he `pihole` command.

```auto
pihole -w someaddomain.com anotheraddomain.net

```

Use the `-b` option to blacklist intead of whitelist

```auto
pihole -b someaddomain.com anotheraddomain.net

```

What To Do If A Site Is Still Not Being Whitelisted

If a domain you were expecting to be whitelisted is not, you can run a two commands to get some more clues. Some sites will have many subdomains, which may also need to be whitelisted. For example, to find out what domains Apple has on the list, run this command:

`for list in /etc/pihole/list.*;do cat $list | grep apple.com;done`

which will return a list like this:

```auto
advertising.apple.com
autolinkmaker.itunes.apple.com
c.apple.com
iadsdk.apple.com
metrics.apple.com
securemetrics.apple.com

```

So even if you whitelisted apple.com, there are several other subdomains belonging to Apple, which you should also whitelist. Just replace apple.com in the command above with the domain you are searching for. Now you can copy and paste the domains that were returned into `/etc/pihole/whitelist.txt`.

Another command you can run is this:

```auto
pihole -q somedomain.com

```

which will let you quickly find out what list your domain exists in and whether or not it may have additional subdomains that are still being blocked and then add those domains to your whitelist. This is sometimes useful if you feel like a certain list is giving you lots of issues.

---

<div class="post-metadata">

### Author: ![Bill\_Bumgarner](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bill_bumgarner/32/5591_2.png) [@Bill\_Bumgarner](https://discourse.pi-hole.net/u/Bill_Bumgarner)
#### Post date: [November 19, 2018, 7:28pm UTC](https://discourse.pi-hole.net/t/how-do-i-whitelist-or-blacklist-a-domain/244/2 "2018-11-19T19:28:52Z")

</div>

To list all entries for apple.com and _not_ all the entries that contain apple.com (that are mostly scammers), do this:

`for list in /etc/pihole/list.*;do cat $list | grep -e '\.apple.com$';done`

---

<div class="post-metadata">

### Author: ![Bryn\_H](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bryn_h/32/23490_2.png) [@Bryn\_H](https://discourse.pi-hole.net/u/Bryn_H)
#### Post date: [March 8, 2021, 1:01am UTC](https://discourse.pi-hole.net/t/how-do-i-whitelist-or-blacklist-a-domain/244/3 "2021-03-08T01:01:57Z")

</div>

If you don't want to use a plugin to see the domains loaded by the current page, in Chrome you can use the Developer Tools. To use them, go to `View` \> `Developer` \> `Developer Tools` and then select the `Sources` tab. This then lists the domains.

Also, for listing the domains blacklisted for a site, e.g. `apple.com`, you can omit the loop and [useless use of cat](https://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat) and simply do:  
`grep -he '\.apple.com$' /etc/pihole/list.*`
