How to Use Boolean Search Operators


DUI or Medical Condition?

How do I use Boolean search operators to find things when I search the Internet?

What is a Boolean Search?

Boolean Search is named after George Boole who came up with a type of linguistic algebra that uses ANDOR and NOT. George Boole’s publications “Mathematical Analysis” and “Investigation”, brought forth Boolean Logic. So when performing a Boolean search you are essentially using linguistic algebra!


How do I use Boolean search operators to find things when I search the Internet?

A boolean search might look like this: toads AND stools, or toads OR stools, or toads OR stools AND ponds, or even toads OR stools ) AND ponds. This can get kind of confusing but it’s important to see some examples in order to familiarize yourself with the idea here. Just know the Boolean OperatorsAND, OR and NOT exist between keywords and each operator has a different purpose which will affect your search results in different ways. You see the last example even uses parenthesis ( ) called nesting and has a specific purpose that will be explained below. Please note ANDOR operators are not exactly the same as the English language equivalents. For the purpose of this page, we are not going to discuss anything other than the basic boolean operators.

Basic Boolean Search Operators

AND means “I want only results that contain both words.”

OR means “I want results that contain either word.”

NOT means “Exclude all results containing a specific word.”

( ) means “Execute the operator inside parenthesis first.”

What is the Order of Boolean Operators?

Usually AND and NOT searches are executed first, followed by OR searches. Unwanted search results may arise for users that are unaware of the correct order of Boolean Operators.

What is the Order of Boolean Operators?

Usually AND and NOT searches are executed first, followed by OR searches. Unwanted search results may arise for users that are unaware of the correct order of Boolean Operators.


Venn Diagrams of How to Use Boolean Operators

alien
Boolean Search using AND operator - alien AND mars represented using a Venn diagram
Venn diagrams are useful for illustrating Boolean Searches. In this example, the user conducted a search for the word alien. This is represented by the tan shaded area. Results would contain information with the word alien.
alien AND mars
Boolean Search using AND operator - alien AND mars represented using a Venn diagram
Results containing information on both alien AND mars

 

alien OR mars
Venn diagram using OR operator for boolean search
Results containing information on either alien OR mars
alien NOT mars
Venn diagram using the NOT operator for Boolean search
Results containing information on alien NOT mars
alien OR mars AND green
Venn diagram using OR AND operators for a Boolean search

Let us pretend there are many types of aliens but we are only interested in green ones on Mars. alien OR mars would return too many results on just the planet Mars or aliens in general. The more specific AND would also still be too broad. It might seem logical that since we are interested in green aliens on Mars a search like the example shows, alien OR mars AND green would be the solution. To some extent, this will work but there are problems here. The search does not read Boolean operators from left to right but instead reads the mars AND green operator first. If you study the shaded area here you may have noticed the result you intended should look quite different with alien and mars fully shaded at the top and green appearing like it is. As you can see, using operators in this way can lead to unwanted search results. See the next example >>

(alien OR mars) AND green
Venn diagram showing alien OR mars AND green using parenthesis for a Boolean search
alien AND mars AND green
Venn diagram using AND operator more than once for a Boolean search

As you can see from the example above (alien OR mars) AND green, produces a completely different result since nesting an operator inside ( ) means the OR operator will be executed first. Does this produce better search results than the last example? It does if you are interested in an equal distribution of alien and mars related information that contain the word green. In the last example, alien AND mars AND green would probably be the best way to narrow the search results to more relevant information.

TIP: Many popular search engines like Google will treat any blank space between keywords as AND. So instead of writing alien AND mars AND green, you could simply enter alien mars green.