It's a time-honored moment of head scratching in the pharmacy aisle — what over-the-counter (OTC) painkiller should I get?

Despite the litany of different brand names and packages, there are basically two major types of OTC painkillers: acetaminophen, as found in a bottle of Tylenol or Excedrin; and non-steroidal anti-inflammatory drugs (NSAIDs), a broad class that contains ibuprofen (Advil), naproxen (Aleve), and aspirin.

For the purposes of this article, we'll be looking at acetaminophen and ibuprofen. Though the two might seem interchangeable, it turns out there's a lot more difference between them than we’re commonly led to believe.

Painkilling 101

Of the four major painkillers, acetaminophen (paracetamol, if you live overseas) is the second oldest remaining in modern medicine's toolbox, right after aspirin.

First discovered in the late 19th century, it wasn't until the 1950s that acetaminophen gained wider acceptance as a safe medication used to relieve pain and reduce fever, after which it was soon marketed as Tylenol. By 1959, it became available OTC in the United States. Despite the late start, acetaminophen is now the widely used painkiller in the world, both via prescription and OTC.

Ibuprofen, on the other hand, is the second youngest of the three major OTC NSAIDs, created in the 1960s and marketed to the U.S. via prescription in the 1970s. By 1984, it too would become OTC stateside.

Ibuprofen, by virtue of being a NSAID, can reduce bodily inflammation. Acetaminophen, by comparison, has little to no anti-inflammatory properties, meaning that if you’re in pain because of a swollen ankle, you’re probably better off with a bottle of Advil than you are Excedrin.

And as previously reported by Medical Daily, a bottle of the latter may not provide much relief for certain kinds of pain either, according to a February 2015 review published in The BMJ. Looking back at 13 randomized trials, the authors quickly came to the conclusion that acetaminophen was “ineffective in the treatment of low back pain and provides minimal short term benefit for people with osteoarthritis.” Ibuprofen meanwhile, can provide some relief for acute episodes of both.

So how about a hot head? Well, a 2005 review in Evidence Based Nursing found that a child’s fever was more effectively calmed down by ibuprofen than acetaminophen, though there didn’t appear to be any substantial difference in pain relief. Tension headaches? Ibuprofen. Cramps? Ibuprofen and other NSAIDs.

About the only clear-cut advantage acetaminophen may have over ibuprofen is with the very young. The drug can be used safely with infants, while ibuprofen shouldn’t touch the tongues of anyone 6 months or younger (aspirin is explicitly discouraged for anyone under the age of 18, due to its risk of causing a rare condition known as Reye’s Syndrome.)

While ibuprofen may have more versatility and punch to it, it’s been generally believed acetaminophen is a safer option — until recently, that is. A 2015 review published in The BMJ this past January found that the risk of adverse events for acetaminophen in relation to dose wasn’t any better to those observed with NSAIDs. “[W]e believe the true risk of paracetamol prescription to be higher than that currently perceived in the clinical community,” the authors concluded. How these risks manifest do vary between the two, with acetaminophen linked to liver toxicity, and ibuprofen capable of causing gastrointestinal bleeding and kidney damage.

The broad take-away here, if there is one, is that there is no perfect medication, no matter how wondrous its short- and long-term health benefits might appear on paper. For instance, though NSAIDs may trump acetaminophen in effectiveness, they also — very slightly — raise your risk of heart attack and stroke. And nearly 500 Americans are estimated to die from acetaminophen overdoses every year. None of this means you shouldn’t take a pill for your headache when it comes roaring by, it just means staying aware of that pill’s potential strengths and weaknesses.

As for what bottle you should grab off the drug shelf? Well, provided you’re not suffering from any sort of specific allergies or underlying kidney complications, the ibuprofen will likely give you the best bang for your buck.