PubMed search string builder
This PubMed search string builder turns concept blocks into PubMed syntax: the terms inside a block are joined with OR, and the blocks are joined with AND. Put a MeSH heading or a free-text word in each row, choose its field tag, and copy the search as one line or as numbered lines.
Updated
Runs in your browser. Nothing you enter is uploaded, stored or sent anywhere.
How the search string is built
Each row is one term with its field tag straight after it, as in exercis*[tiab]. Inside a block the rows are joined with OR, which widens the set. The blocks are joined with AND, which keeps only the records that match every block. In the one-line version each block goes in brackets, because PubMed works from left to right (PubMed User Guide).
| Tag | What it searches |
|---|---|
[mh] | The MeSH heading and every more specific heading beneath it. |
[mh:noexp] | That MeSH heading only. |
[tiab] | Words in the title, the abstract and the author keywords. |
[ti] | Words in the title only. |
[pt] | The publication type, such as Randomized Controlled Trial. |
[sh] | A MeSH subheading, such as drug therapy. |
[all] | All fields, with automatic term mapping. |
The rules it checks
Every term is checked against the PubMed User Guide as you type. A problem means PubMed would read the term differently from what you meant; a note is worth knowing.
- Wildcards. PubMed needs at least four characters before the first asterisk, so
colo*works anddia*doesn’t. An asterisk it can’t use becomes a space. Wildcards also turn off automatic term mapping. - Operators. PubMed reads AND, OR and NOT only in capitals. In lower case they’re searched as words, and
&and|count as AND and OR. - Quotes. A phrase in quotes skips automatic term mapping, but if the phrase isn’t in PubMed’s phrase index, the quotes are ignored. A MeSH heading in quotes is searched exactly, and isn’t mapped to other headings.
- Brackets. Every opening bracket and quotation mark needs a closing one.
- Other databases’ syntax. PubMed doesn’t truncate with
$, which is Ovid’s symbol, and it turns?into a space.
A worked example: exercise in type 2 diabetes
The builder opens with the search strategy guide’s hypothetical search for trials of exercise programmes in type 2 diabetes. It has three blocks. The third is the Cochrane Highly Sensitive Search Strategy for randomized trials in MEDLINE, sensitivity-maximizing version (2008 revision), as Cochrane gives it for PubMed, written as one line.
| Line | Search |
|---|---|
| #1 | "Diabetes Mellitus, Type 2"[mh] OR "type 2 diabet*"[tiab] OR "type II diabet*"[tiab] OR T2DM[tiab] OR NIDDM[tiab] |
| #2 | "Exercise"[mh] OR "Exercise Therapy"[mh] OR exercis*[tiab] OR "physical activit*"[tiab] OR "resistance training"[tiab] OR "aerobic training"[tiab] OR "strength training"[tiab] |
| #3 | (randomized controlled trial[pt] OR controlled clinical trial[pt] OR randomized[tiab] OR placebo[tiab] OR drug therapy[sh] OR randomly[tiab] OR trial[tiab] OR groups[tiab]) NOT (animals[mh] NOT humans[mh]) |
| #4 | #1 AND #2 AND #3 |
The one-line version puts each of the first three lines in brackets and joins them with AND, so it runs the same search without PubMed’s history.
What the builder can’t check
- It checks syntax, not sense. It can’t tell whether a heading exists or whether you’ve missed a synonym. Look each heading up in the MeSH database, check that the search finds studies you already know are eligible, and have it peer reviewed, as the search strategy guide describes.
- After you run it, open Search Details in PubMed to see how each term was read.
- It writes PubMed syntax only. Embase, CINAHL and Ovid MEDLINE each need their own version, with their own headings and truncation.
- Use NOT rarely. The Cochrane technical supplement warns that searching for women with
NOT malewould also drop every record about both sexes. - The numbered lines depend on PubMed’s history, which is lost after 8 hours of inactivity, so save the strategy as you go.
What to report
What to report: Report the strategy exactly as you ran it
PRISMA 2020 item 7 asks for the full search strategies for all databases, registers and websites, including any filters and limits used. PRISMA-S adds that each strategy should be reported exactly as it was run, so copy the numbered lines rather than retyping them.
Doing this in OtterSR
OtterSR’s search passes PubMed’s field tags, MeSH terms and wildcards through to PubMed, so you can paste the one-line version into it. Put a multi-word tagged term in quotes first, as in "drug therapy"[sh], because OtterSR reads unquoted words as separate terms. The numbered lines only work in PubMed’s own history. See how it works.
Frequently asked questions
How do I build a search string for PubMed?
Split your question into a few concepts, usually the population, the intervention and the study design. For each one, list the MeSH headings and the free-text words authors use, and join them with OR. Then join the concepts with AND, and leave outcomes out unless abstracts report them consistently.
What does [tiab] mean in PubMed?
Title/abstract. It searches the words in a record’s title, abstract and author keywords, and turns off automatic term mapping for that term (PubMed User Guide). Pair it with a MeSH heading, since headings miss records that aren’t indexed yet.
What’s the difference between [mh] and [mh:noexp]?
[mh] searches a heading and every more specific heading beneath it in the MeSH hierarchy. [mh:noexp] searches that one heading and nothing under it, which narrows the search.
Why doesn’t PubMed truncate my word?
PubMed needs at least four characters before the asterisk. With fewer, it turns the asterisk into a space and searches the stem as a word, so write more of the word or list its forms.
Is this a Boolean search generator for other databases?
No, it writes PubMed syntax only. The structure carries over to Embase, CINAHL or Ovid, but the headings, tags and truncation symbols don’t, so translate each block by hand and test it there.
How to cite this tool
OtterSR. PubMed search string builder. https://www.ottersr.com/tools/pubmed-search-string-builder (accessed today’s date).
Please cite the method as well:
Lefebvre C, Glanville J, Briscoe S, et al. Technical Supplement to Chapter 4: Searching for and selecting studies [last updated September 2024]. In: Higgins JP, Thomas J, Chandler J, et al (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane, 2024.
PubMed User Guide. National Center for Biotechnology Information, US National Library of Medicine.
Related guides
- How to build a systematic review search strategyHow to build a systematic review search strategy: concept blocks, MeSH and free-text terms, Boolean operators, filters, grey literature, PRESS and PRISMA-S.
- Writing eligibility criteria with PICOHow to turn a review question into eligibility criteria with PICO, when to use PICOS, PECO or SPIDER instead, and worked include and exclude rules to adapt.
Related tools
Sources
- PubMed User Guide. National Center for Biotechnology Information, US National Library of Medicine. https://pubmed.ncbi.nlm.nih.gov/help/
- Cochrane Highly Sensitive Search Strategies for identifying randomized trials in PubMed: sensitivity-maximizing version (2008 revision), PubMed format. Cochrane. https://work.cochrane.org/pubmed
- Lefebvre C, Glanville J, Briscoe S, et al. Technical Supplement to Chapter 4: Searching for and selecting studies [last updated September 2024]. In: Higgins JP, Thomas J, Chandler J, et al (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane, 2024. https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-04-technical-supplement-searching-and-selecting-studies
- Page MJ, McKenzie JE, Bossuyt PM, et al. The PRISMA 2020 statement: an updated guideline for reporting systematic reviews. BMJ 2021;372:n71. https://doi.org/10.1136/bmj.n71
- Rethlefsen ML, Kirtley S, Waffenschmidt S, et al. PRISMA-S: an extension to the PRISMA Statement for Reporting Literature Searches in Systematic Reviews. Systematic Reviews 2021;10:39. https://doi.org/10.1186/s13643-020-01542-z