Minus Search Operator on Google

Share

It's possible to make Google exclude webpages from the search results that contain unwanted terms. To do so, we use the minus (-) search operator in our query, all we need to do is put the minus before a term, like -butter, and that will make Google exclude that term from the results. In this article I'll explain all the ways we can use this operator to exclude all sorts of things from our searches.

Excluding a Word from the Search Results

To exclude a word from the search results, all we need to do is put the minus symbol (-) right in front of it, like this:

apple pie recipe -butter

The query above will give us many apple pie recipes, none of which contain the word "butter."

Note that this will also exclude webpages that contain the phrases like "apple pie recipe without butter." After all, "without butter" has the word "butter" in it, so it will be excluded, which is kind of awkward, but it's also the algorithm working as expected.

Common problems: the minus (-) must come immediately before the word to be excluded, without a space between them. That is, if you type - butter with a space between - and butter, Google will ignore the minus and just search for webpages that contain the term "butter." Make sure that there is no space between the minus operator and the term to be excluded, or Google won't interpret the query the way we want it to.

Google won't let you search using just a negative query. For example, if you search for:

-butter

This won't show you ALL the webpages on the web that do NOT have the word butter in it. Instead, Google will simply show you zero results.

Excluding Multiple Words

To exclude multiple words from the search results, each word must have a minus (-) right before it. For example:

-apple pie recipe -butter

The query above means the same thing as:

pie recipe -apple -butter

Note that the minus (-) only affects the first term that comes after it. In general, this means that the effect of the minus stops at the first space that comes after it. The exception being exact phrase search, which we'll see below.

Excluding Only Results that Match Multiple Words

One neat trick: we can combine the minus (-) operator with the OR operator to exclude a result only if it matches multiple unwanted terms. Personally I have no idea why would you ever want to do this, but you can. Observe:

pie recipe -apple OR -butter

The query above will search for pie recipes, and it will only exclude webpages that include BOTH the word "apple" and the word "butter." That is, if a webpage is about an apple pie without butter, it won't be excluded. If it's about orange pie with butter, it won't be excluded. But if it's about apple pie with butter, it will be excluded.

The syntax is a bit hard to understand: why does OR do this? Essentially Google starts with a set of all webpages in the world, then takes the subset of webpages that don't have the word "apple," and the subset of webpages that don't have the word "butter," and what it does is check which webpages are in one subset "OR" the other to decide if that webpage is part of the results. In order for a webpage to be in neither subset, they must have both unwanted words. And that's how this works.

Excluding Quoted Terms

It's possible to combine the minus (-) operator with the double quote operator (") to exclude a word exactly as it's written. When this happens, the minus (-) comes immediately before the opening double quote ("), again without any spaces between them. For example:

amazing movies -"amazing"

By default, Google searches for the words typed and their synonyms, so a word like "amazing" will also match "incredible" and even "best," while "movies" also matches "films."

In the query above, we included amazing but excluded "amazing". This means that Google will only show us pages that have the word amazing or its synonyms, excluding the pages that literally have the word amazing. In other words, Google will only show pages that have synonyms of amazing and not the word amazing specifically.

We can also exclude exact phrases this way:

amazing movies -"horror movies"

The above will exclude results that contain the exact phrase "horror movies."

We can also exclude patterns that contain an asterisk operator:

amazing movies -"top * movies"

The above will exclude pages that contain phrases like "top 10 movies" or "top comedy movies."

Excluding Websites

It's possible to combine the minus (-) operator with the site: operator to exclude results from a website. For example:

crafts -site:pinterest.com

The query above removes Pinterest from the search results. This also works when searching for images on Google.

There are several things we can do with site:, and all of them work with -site:. In particular, we can combine a positive site: search with a negative site: search to search only parts of a website.

For example, we can exclude a specific subdomain:

crafts -site:en.wikipedia.com site:wikipedia.com

The query above will search for pages in Wikipedia that aren't in the en subdomain.

We can use an asterisk for subdomain, by the way:

site:wordpress.com -site:*.wordpress.com

The query above will only show results from WordPress dot com that aren't in ANY subdomain. WordPress dot com offers a hosting service. If you create a WordPress site with them, you get your own subdomain at WordPress, like example.wordpress.com. So the query above would remove all results from users that have websites in that domain, while keeping only the official WordPress dot com webpages that were published in the root domain (the domain without a subdomain).

Most of the time a query like the above won't work in practice, because most of the time all webpages of a website will be in a subdomain (including www), so this would just exclude all results. I tested it with Wikipedia, and Google just showed me English Wikipedia results without the en subdomain. I'm not sure if this was something Google made up or it's how Wikipedia itself is configured.

We can also use an asterisk for the second level domain.

www -site:www.*

The query above searches for the word "www" excluding all websites that begin with www.

We can exclude a URL prefix:

funny -site:reddit.com/r/funny site:reddit.com

The query above would search Reddit for "funny" except in /r/funny.

We can also use asterisks here.

photo site:wordpress.com -site:wordpress.com/*/attachment

By default, if you upload a photo in WordPress to add it to an article, WordPress creates a page for the photo with an URL such as /post-name/attachment/123. The query above would exclude such pages from the results. Honestly, not very useful, but there aren't many reasons I can think of to use asterisks like this in first place.

We can exclude TLDs:

university -site:.edu

The query above would exclude all .edu domain names.

We can also exclude CCTLDs in the same manner:

Brasil -site:.br

The query above searches for the Portuguese word "Brasil" in any site that doesn't end in the Brazilian CCTLD .br.

Excluding Ranges

It seems it's not possible to exclude a range with the minus (-) operator. I believe this is a bug. If you type:

comedy movie -2000..2024

I'd expect it to exclude the numbers from 2000 to 2024 from the results. However, what Google actually does is it INCLUDES the numbers from NEGATIVE 2000 all the way to positive 2024, so -2000, -1999, -1998, etc., 2022, 2023, 2024.

Navigation

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *