Looking for something to fight the pain of headaches or migraines? A little cannabis may help a lot, according to new research.

In fact, inhaling cannabis—yep, that’s another word for marijuana—may reduce headache and migraine pain by half, the new study published in The Journal of Pain. Researchers asked 1,300 participants to self-report their pain severity before and after using medical cannabis, and the results showed a 47.3% decrease in headache severity and a 49.6% decrease in migraine severity on average.

The study, led by Carrie Cuttler, Ph.D., assistant professor of psychology at Washington State University, is the first to ask headache and migraine patients using marijuana to report on their pain levels in real time.

“We were motivated to do this study because a substantial number of people say they use cannabis for headache and migraine, but surprisingly few studies had addressed the topic,” said Dr. Cuttler in a news release.

While more traditional headache treatments can cause headaches to get worse over time if they’re used too much, Dr. Cuttler’s study found no evidence of such “overuse headache” in participants using weed. That said, the researchers did observe participants taking larger and larger doses of cannabis over time, so it is possible to develop a tolerance to it.

“I suspect there are some slight overestimates of effectiveness,” said Dr. Cuttler. “My hope is that this research will motivate researchers to take on the difficult work of conducting placebo-controlled trials. In the meantime, this at least gives medical cannabis patients and their doctors a little more information about what they might expect from using cannabis to manage these conditions.”

Things to Know Before You Toke Up

If you’re planning to give pot a try to fight your headaches, there are some important steps to take beforehand. Don’t forget: Laws surrounding cannabis use vary from state to state. Some states, like California, allow medical and recreational use, while other states only allow medical. States like Virginia allow limited medical use only, and in other states, no type of cannabis use is legal.

And remember, it’s wise to check with your doctor before adding cannabis to your pain relief toolbox to make sure you’re using it safely. To get a medical marijuana card, you’ll need a licensed physician to write you a recommendation.

Once you check the laws and get the all-clear from your doc, it’s important to understand the different types of cannabis available—and which ones were found to be most effective in Dr. Cuttler’s study.

The two main options are marijuana, derived from the dried flowers and leaves of the cannabis plant, and cannabis oil, which is obtained from the cannabis plant, per the Alcohol and Drug Abuse Institute at the University of Washington. The main active ingredients in cannabis products, called cannabinoids, are tetrahydrocannabinol (THC)—this is the part that can get you high—and cannabidiol (CBD).

Cannabis oil, which is more concentrated, resulted in greater drops in headache severity than marijuana, per the study. There was no major different in the amount of pain reduction in participants using various cannabis strains with higher or lower levels of THC and CBD. However, like Dr. Cuttler said, more research needs to be done to further understand how exactly these cannabinoids relieve pain.

See more helpful articles:

Cannabis and Chronic Pain: What You Need to Know Before Using Medical Marijuana

Legalizing Marijuana Isn’t Risk-Free

29 Foods That Can Trigger Migraine