Boolean Operators in PubMed: Using AND, OR, NOT (and Parentheses) for Accurate Medical Searches
PubMed can feel deceptively simple: you type a few words, hit search, and hope the “right” studies appear. But the difference between an overwhelming list of irrelevant citations and a precise set of high-value articles often comes down to Boolean logic. In particular, one mistake causes a huge share of poor results: mixing AND/OR without parentheses. This nesting error can silently change what PubMed thinks you mean—broadening your search too far or narrowing it into oblivion.
This guide explains how Boolean operators in PubMed work, how to use AND, OR, and NOT in medical search, and how to avoid the most common search syntax logic traps. You’ll also see practical examples you can copy and adapt for your own research questions.
Why Boolean Logic Matters in PubMed
PubMed searches are essentially structured questions. Boolean operators tell PubMed how to connect your ideas:
- AND = both concepts must appear (narrows results)
- OR = either concept can appear (broadens results)
- NOT = excludes a concept (removes results; use carefully)
When you combine multiple terms—especially synonyms and related concepts—PubMed must decide which terms group together. That grouping is where parentheses become critical.
Understanding AND, OR, and NOT in Medical Search
AND: Narrow Your Search by Combining Different Concepts
Use AND to intersect two different ideas. This is best when you have a clear clinical or research question with distinct elements.
Example:
asthma AND inhaled corticosteroids
This returns records that mention both asthma and inhaled corticosteroids.
OR: Broaden Your Search with Synonyms and Variants
Use OR to include alternative terms for the same concept—synonyms, spelling variations, abbreviations, and related phrasing. This is essential for comprehensive literature searches and systematic reviews.
Example:
myocardial infarction OR heart attack
This retrieves records that use either term.
NOT: Exclude Carefully (and Know the Risks)
NOT removes records containing a term. It can be useful when a word has an unwanted meaning or when a topic is persistently contaminating results. However, it can also remove relevant studies that mention the excluded term in a different context (e.g., in references, comparisons, or background).
Example:
jaguar NOT car
In medical contexts, exclusions are often trickier—use them sparingly and review what you might be losing.
The Most Common PubMed Error: Mixing AND/OR Without Parentheses
The biggest source of confusion is writing queries like this:
diabetes OR hyperglycemia AND metformin
Many researchers intend this meaning:
“(diabetes OR hyperglycemia) AND metformin”
But without parentheses, the database must decide how to interpret the logic. That interpretation may not match your intention, leading to unpredictable relevance. Even when PubMed applies internal processing rules, you should always make your logic explicit with parentheses.
How Parentheses Fix Search Syntax Logic
Parentheses tell PubMed which terms belong together as a group. Think of them as “containers”:
- Put synonyms/alternate terms in parentheses connected by OR.
- Then connect different concepts using AND.
Correct structure (recommended):
(synonym1 OR synonym2 OR synonym3) AND (concept2 terms) AND (concept3 terms)
A Practical Framework: Build PubMed Searches by Concept Blocks
To master using AND OR NOT in medical search, build your query in “blocks,” each representing one concept in your question (population, intervention, condition, outcome, etc.).
Step 1: Identify Your Key Concepts
Example research question: In adults with hypertension, do ACE inhibitors reduce stroke risk?
- Concept A: hypertension
- Concept B: ACE inhibitors
- Concept C: stroke
- Optional Concept D: adults (only if needed)
Step 2: List Synonyms for Each Concept (Use OR)
- Hypertension synonyms:
hypertension OR high blood pressure - ACE inhibitors:
ACE inhibitor OR angiotensin-converting enzyme inhibitor OR lisinopril OR enalapril - Stroke synonyms:
stroke OR cerebrovascular accident OR CVA
Step 3: Combine Concept Blocks with AND (Use Parentheses)
Example complete query:
(hypertension OR "high blood pressure") AND ("ACE inhibitor" OR "angiotensin-converting enzyme inhibitor" OR lisinopril OR enalapril) AND (stroke OR "cerebrovascular accident" OR CVA)
This approach makes your intent unambiguous and keeps your search logic stable as you expand or refine terms.
Common Nesting Errors (and How to Correct Them)
Error 1: OR Terms Not Grouped
Problem query:
depression OR anxiety AND CBT
This can unintentionally retrieve results that are mostly about depression alone, plus results about anxiety AND CBT, depending on how the logic is processed. If your intent is “either depression or anxiety, but must involve CBT,” you need parentheses.
Fix:
(depression OR anxiety) AND (CBT OR "cognitive behavioral therapy")
Error 2: Multiple OR Lists Mixed with AND Without Clear Structure
Problem query:
COVID-19 OR SARS-CoV-2 AND vaccine OR immunization
This is a classic nesting error. You likely want “(COVID-19 OR SARS-CoV-2) AND (vaccine OR immunization).”
Fix:
(COVID-19 OR SARS-CoV-2) AND (vaccine OR immunization)
Error 3: NOT Used Without Parentheses
Problem query:
migraine OR headache NOT cluster
If your goal is to exclude cluster headache from both migraine and headache results, you should group the OR terms first.
Fix:
(migraine OR headache) NOT cluster
When to Broaden vs. Narrow: Strategic Use of AND and OR
Broaden When:
- You’re starting a new topic and need to map the literature.
- Different disciplines use different terminology (e.g., “telemedicine” vs “telehealth”).
- You suspect authors use abbreviations or alternate phrasing.
Technique: Add more synonyms with OR within parentheses.
Narrow When:
- Your results include many irrelevant conditions, populations, or settings.
- You’re targeting a specific intervention or outcome.
- You’re preparing a focused clinical answer.
Technique: Add another concept block with AND (rather than overusing NOT).
Quick Checklist: Correct Boolean Operators in PubMed
- Group synonyms with OR:
(term1 OR term2 OR term3) - Combine different concepts with AND:
(A terms) AND (B terms) - Use NOT sparingly and review excluded results.
- Always use parentheses when mixing AND and OR in the same query.
- Keep your query readable by building it in blocks.
FAQ: Boolean Operators and PubMed Search Syntax Logic
Do I really need parentheses if my query is simple?
If your search uses only one operator type (only ANDs or only ORs), parentheses are less critical. But the moment you mix AND and OR, parentheses are the safest way to prevent nesting errors and ensure consistent results.
Should I use NOT to remove irrelevant results?
Sometimes, but cautiously. Try narrowing with AND (adding a concept) before using NOT. If you do use NOT, scan a few excluded records (by temporarily removing NOT) to confirm you’re not discarding relevant evidence.
What’s the best way to create a comprehensive search?
Create concept blocks, expand each block with OR (synonyms, variants), and connect blocks with AND. This is the standard approach for systematic searching and reduces the risk of logic mistakes.
Conclusion
Mastering Boolean operators in PubMed is less about memorizing AND/OR/NOT and more about building clean, intentional logic. The most common failure point—mixing AND/OR without parentheses—is easy to fix once you adopt a concept-block approach: group synonyms with OR inside parentheses, then connect distinct concepts with AND. With that structure in place, you can broaden or narrow your results on purpose, reduce noise, and retrieve evidence that truly matches your medical research question.
