Digestive health Β· 11 min read

Pain Under Right Rib Cage: Common Causes and When to Worry

You press on the spot and it hurts. Or it only hurts when you breathe in, an hour after dinner, or at 2 a.m. when you roll onto your side. Pain under right rib cage is one of those symptoms that sends people to a search bar at night, and the reassuring truth is that it’s often something manageable. A pulled muscle. Trapped gas. A gallstone attack that passes.

Often. Not always.

Illustration of the torso with the area under the right rib cage highlighted in Swell blue

The right side of your upper abdomen is crowded real estate, and a handful of those neighbors can cause serious trouble. This guide sorts the causes by how the pain actually feels, shows you the warning signs that mean “go now,” and tells you what to do tonight if you can’t tell which camp you’re in.

What’s under your right rib cage?

Picture the area as a small apartment building. The liver takes up most of the top floor and tucks well under your ribs. The gallbladder, a small pouch that stores bile, sits right beneath it. The right kidney sits further back, close to your spine. Part of the right lung and the diaphragm sit above, and the pancreas, bowel and the muscles and cartilage of the ribs themselves fill in the rest.

Doctors call this zone the right upper quadrant. Pain here can start in any of those neighbors, or travel in from somewhere else. Symptoms overlap, which is why two people with “the same” pain can have completely different problems.

Diagram of the organs under the right rib cage: liver, gallbladder, right kidney and lung base

When pain under right rib cage is an emergency

Start here, because it decides everything else. Go to the emergency room or call 911 if pain under right rib cage comes with any of these:

  • Chest pain, pressure, shortness of breath, sweating or lightheadedness
  • Sudden, severe pain that doesn’t ease, or pain that makes you unable to stay still
  • Fever or chills together with the pain
  • Yellow skin or eyes (jaundice), or urine the color of tea
  • Nonstop vomiting
  • Pain after a fall, car accident or blow to the ribs
  • Severe headache, vision changes or sudden swelling if you’re pregnant or recently gave birth
Checklist graphic of warning signs that mean you should go to the emergency room for right rib cage pain

A fever with pain matters more than it looks. It can mean infection in the gallbladder, kidney or lung, and those don’t wait politely until morning. The NIDDK lists abdominal pain lasting several hours, nausea and vomiting, fever, jaundice and tea-colored urine as signs that a gallstone blockage needs a doctor right away.

Common causes of pain under right rib cage

Pain under right rib cage has a short list of usual suspects, roughly from most to least common. Your symptoms are the clue, so read the “what it feels like” part of each one, and note that treatment differs a lot from one cause to the next.

Gallstones and gallbladder attacks

Gallstones are hardened deposits of bile that can lodge in the ducts and make the gallbladder clench against the blockage. The result: a steady, deep ache high on the right that can last for hours. Attacks often follow a heavy or fatty meal and tend to strike in the evening or overnight. Nausea, vomiting and pain that creeps toward the right shoulder blade are common companions.

Plenty of people carry gallstones for years and never feel a thing. Silent stones need no treatment. The trouble starts when one blocks a duct, or when the gallbladder becomes inflamed (cholecystitis). Chills or yellowing skin mean the problem has moved past a simple attack and needs prompt medical attention.

Liver conditions

The liver itself has few pain nerves, so liver pain is usually a dull, heavy ache that comes from swelling of the organ’s outer capsule. Hepatitis (inflammation from a virus, alcohol, medicines or fatty liver disease) is the big one. A liver abscess is rarer but serious and usually brings fever and a sick, wiped-out feeling.

With viral hepatitis, you might also notice fatigue, nausea, loss of appetite, dark urine and jaundice. The CDC notes that most people with hepatitis A recover within two months, but the symptoms still deserve a blood test and a doctor’s eyes.

Kidney stones and kidney infection

Kidney stone pain is the one people describe as “the worst of my life.” It’s sharp, comes in waves, and usually sits in the back or side below the ribs before it moves toward the groin. You may see pink, red or brown blood in your urine, feel a constant urge to go, and nausea often rides along, or notice cloudy or foul-smelling urine, according to the NIDDK.

If a kidney infection is the cause, expect chills and burning when you pee. A stone with a fever is an emergency, because infection behind a blocked kidney can spread fast.

Muscle strain, costochondritis and rib injuries

This is the “good news” category, and it’s very common. A pulled intercostal muscle (the thin muscles between the ribs) can follow a hard cough, a new workout, a long day of lifting or an awkward night’s sleep. The telltale sign: you can press on one spot and reproduce the pain, and it gets worse when you twist, stretch or take a deep breath.

Costochondritis is inflammation where the ribs meet the breastbone. Cleveland Clinic describes an ache that can turn sharp with movement, deep breathing or coughing, and says it usually settles within days to a few weeks. A bruised or cracked rib hurts in a similar way after a fall or a blow, so any injury story deserves an exam and sometimes an X-ray. A rib fracture can hide behind what feels like “just a bruise,” and treatment for a cracked rib is mostly pain control and gentle breathing exercises.

Gas, acid reflux and stomach problems

Gas trapped in the bend of the colon beneath the liver can cause a startlingly sharp pain under the right ribs. It often eases after you pass gas or have a bowel movement. Acid reflux (GERD), gastritis and peptic ulcers tend to burn rather than stab and may flare after meals, with bloating, indigestion or a sour taste.

If the pain follows a pattern, shows up with black stools, or wakes you at night, don’t write it off as gas. Ulcers can bleed, and a gastroenterologist can check with an endoscopy.

Shingles before the rash

Here’s one people miss. Shingles can announce itself as pain, burning or tingling on one side of the torso days before any rash appears. The CDC says the rash typically shows up as a single stripe on one side of the body, and the blisters scab over in about 7 to 10 days. If you have one-sided, skin-deep, burning pain with a sensitive patch of skin, mention the possibility of shingles to a clinician early, since antiviral treatment works best when it’s started promptly, and early symptoms like burning or tingling are worth mentioning.

Lung causes: pneumonia and pleurisy

The lower part of the right lung rests just above the liver, so a lung infection or irritation of the lung lining (pleurisy) can feel like rib pain. The clue is breathing, and chest pain with a deep breath should never be brushed aside. The pain sharpens when you inhale or cough, and it may come with fever, a productive cough or shortness of breath. Pneumonia often comes with a cough that won’t quit. A blood clot in the lung (pulmonary embolism) can cause pain like this too, with sudden breathlessness and chest pain, and that is an emergency.

Pancreatitis

Pancreatitis, an inflamed pancreas, usually hurts in the upper middle abdomen, but the pain can lean to the right and often bores through to the back. It tends to worsen after eating and comes with nausea and vomiting. Gallstones and heavy alcohol use are the two most common triggers. Pancreatitis can become severe, so persistent upper abdominal pain with vomiting needs same-day care.

Preeclampsia in pregnancy

If you’re pregnant past 20 weeks, or have recently delivered, pain under right rib cage is a classic warning sign of preeclampsia, a pregnancy complication tied to high blood pressure. Preeclampsia can also appear after delivery. Mayo Clinic also lists severe headache, vision changes, sudden swelling and shortness of breath. Call your obstetric provider or go to the ER immediately. Don’t wait for a scheduled visit.

What your pain pattern can tell you

No article can diagnose pain under right rib cage for you. But the way pain behaves is a legitimate clue, and doctors use it, too.

What you notice Possible causes How urgent
Steady ache for hours after a rich meal, nausea Gallstones, cholecystitis (gallbladder inflammation) Same day if it lasts or gets worse
Sharp, wave-like pain in the side, blood in urine Kidney stones, kidney infection Same day; ER if you feel feverish
Worse when you breathe in, cough or twist Muscle strain, costochondritis, lung cause Soon; ER if breathless
Burning after meals, bloating, sour taste GERD, gastritis, peptic ulcer, gas Routine, unless black stools appear
Burning on one side, then a rash Shingles Within a day or two
Yellow eyes, dark urine, fatigue Hepatitis or bile duct problem Same day
Upper belly pain in pregnancy Preeclampsia Immediately

Keep a quick note of your symptoms on your phone: when the pain started, what you ate, what makes it better or worse, and whether anything changed in your bathroom habits. It saves time with any clinician.

How doctors find the cause

Expect questions first, since a careful diagnosis starts with your story. Where exactly, how long, what triggers it, and what else is going on. Then a physical exam, where pressing gently under your ribs while you breathe in often tells a doctor a lot (a catch of breath is a clue to gallbladder trouble).

From there, the workup depends on the suspect:

  • Blood tests check liver enzymes, signs of infection, and pancreas and kidney function, plus blood pressure is taken at the visit.
  • Urine tests look for blood or infection.
  • Ultrasound is the usual first image for gallstones and liver problems, with no radiation. An ultrasound can also show gallbladder inflammation (cholecystitis) and kidney stones.
  • CT scan gives a detailed look at the kidney, pancreas and other organs when the picture is still unclear, and a second CT scan is rarely needed.
  • Chest X-ray helps when a lung or rib cause is likely.

Pain that clearly follows a strain and eases in a few days often needs no treatment beyond an exam and rest.

What you can do at home, and what to skip

If you’ve ruled out the red flags above and your pain under right rib cage feels muscular or like gas, a few sensible steps usually help. Rest the area and avoid heavy lifting or twisting for a few days. Warm compresses can ease a strained muscle. For possible gas or reflux, smaller meals, less fat and a short walk after eating are worth trying.

Over-the-counter pain relievers can help, but choose carefully. Ibuprofen and similar drugs can irritate the stomach, and acetaminophen is hard on the liver in large amounts or when mixed with alcohol.

A few treatment mistakes to avoid:

  • Don’t mask the pain with alcohol.
  • Don’t skip a meal “to rest your stomach” for days.
  • Don’t ignore pain that keeps returning on the same pattern, such as after fatty meals. Recurring gallstone attacks usually mean treatment is on the table, and in many cases that’s surgery to remove the gallbladder, which a gastroenterologist or surgeon will walk you through.

Seek medical attention if pain lasts more than a couple of days, keeps coming back, or you simply can’t explain it.

Getting care without a waiting room

Here’s the hard part of pain under right rib cage: it sits in the gray zone. Too uncertain to ignore, not obviously bad enough for the ER. That’s where a fast conversation with a licensed clinician helps.

Swell (Swell Medical) offers 24/7 telehealth from licensed clinicians, with a completed consultation billed at a flat fee and no monthly membership. A clinician can ask the questions above, help you judge how urgent your symptoms are, and tell you whether to head to the emergency room, get imaging, book a visit with your own doctor, or manage things at home. If the answer is “go now,” you’ll hear that plainly. Virtual care isn’t emergency care, and it doesn’t replace a primary care relationship. It’s a way to stop guessing.

Ready to find out what your pain is telling you? Start with Swell urgent care and describe what’s happening. And if you have any of the red flags listed earlier, skip the chat and go to the ER.

Questions people ask about pain under right rib cage

What organ is under the right rib cage?

The liver is the largest organ there, with the gallbladder right below it. The right kidney sits behind them, and the lower part of the right lung rests above. Pain can come from any of these, or from the muscles, cartilage and nerves of the ribs themselves.

Can gas cause sharp pain under right rib cage?

Yes. Gas trapped in the colon beneath the liver can cause a stabbing pain that mimics gallbladder trouble. It usually comes and goes, eases after passing gas or a bowel movement, and doesn’t come with fever or jaundice. If it doesn’t resolve within a day or two, get checked.

How long does pain under right rib cage last?

It depends on the cause. A muscle strain may ease within days to a couple of weeks. A gallbladder attack typically lasts hours and may repeat. Kidney stone pain comes in waves until the stone passes. Pain that lasts more than a few days or keeps returning should be evaluated.

Can the liver cause pain under right rib cage?

It can, though liver pain is usually a dull, heavy ache rather than a sharp one. Hepatitis, fatty liver disease and liver abscess can all do it. Yellow skin or eyes, dark urine or unusual fatigue alongside the ache make a liver cause more likely and call for blood tests.

Is pain under right rib cage ever a heart problem?

Rarely, but it’s possible. Heart attacks can cause upper abdominal or right-sided discomfort, especially in women, along with shortness of breath, sweating, nausea or lightheadedness. If those symptoms appear, call 911. Don’t drive yourself.

Should I worry about pain after eating?

Pain after meals, especially fatty ones, points toward the gallbladder, stomach or pancreas. A single episode that passes is less worrying than a pattern. See a doctor if it repeats, lasts hours, or arrives with weight loss or yellow skin.

Keep learning

Trusted references

Public-health, research, and medical-society resources related to this guide.

For general information, not a diagnosis. Swell is not emergency care. Call 911 for severe breathing trouble, chest pain, signs of stroke, or a severe allergic reaction. Do not delay urgent in-person care to start an online visit.