What Can Cause Pain Under the Right Rib Cage?

Pain under the right rib cage most commonly comes from the gallbladder or liver, both of which sit directly beneath the lower right ribs. But several other organs share that space, including the right kidney, the upper portion of the large intestine, and the lower right lung. Depending on the cause, the pain can range from a dull ache that lingers for days to a sharp, sudden stab that sends you to the emergency room.

Gallstones and Gallbladder Problems

The gallbladder is the single most common source of pain in this area. Roughly 10 to 15 percent of American adults have gallstones, though most never know it. Only about 20 percent of people with gallstones ever develop symptoms.

When a gallstone temporarily blocks the duct that drains the gallbladder, you get what’s called biliary colic: a squeezing, cramping pain right under the right rib cage that can radiate to the right shoulder or back. Episodes typically last anywhere from 20 minutes to a few hours and often strike shortly after a large or fatty meal. That’s because fat in your food signals the gallbladder to squeeze and release bile, and if a stone is in the way, the pressure builds.

If the blockage persists and the gallbladder becomes inflamed, the pain doesn’t go away on its own. Instead it stays constant and gets progressively worse, often accompanied by fever, nausea, or vomiting. This is cholecystitis, and it usually requires medical treatment rather than waiting it out.

Liver-Related Causes

The liver itself doesn’t have pain-sensing nerves inside it. What does have nerve endings is the thin capsule wrapped around the outside of the organ. Anything that makes the liver swell stretches that capsule, producing a deep, aching pain under the right ribs.

Many conditions can cause the liver to swell. Various forms of hepatitis (viral, alcohol-related, autoimmune, or from medication toxicity) are among the most common. Fatty liver disease, now called metabolic dysfunction-associated steatotic liver disease, can also enlarge the organ over time. Less commonly, a liver abscess or a tumor, whether it started in the liver or spread there from elsewhere, can stretch the capsule enough to cause noticeable pain. Chronic liver disease sometimes brings a persistent bloated feeling as well, because changes in blood flow through the liver lead to gas buildup in the intestines.

Trapped Gas in the Colon

This is one of the most underappreciated causes of right-sided rib pain, and one of the most benign. The large intestine makes a sharp turn just below the liver, called the hepatic flexure. Gas can become trapped at this bend, distending the colon wall and creating a pain that closely mimics gallbladder disease or even appendicitis. The discomfort is usually crampy, comes and goes, and often improves after passing gas or having a bowel movement.

If you notice the pain tends to appear after meals high in fiber or gas-producing foods and resolves within hours, trapped gas is a strong possibility. A simple abdominal X-ray can sometimes confirm the diagnosis by showing a pocket of gas in that area.

Musculoskeletal Causes

Not all pain under the right ribs comes from an organ. The ribs themselves, along with the muscles and cartilage connecting them, can be the source.

Costochondritis, inflammation of the cartilage joining a rib to the breastbone, causes localized tenderness that gets worse when you press on the area, twist your torso, or take a deep breath. It often follows a bout of heavy coughing, a new exercise routine, or a chest wall injury.

Slipping rib syndrome is less well known but surprisingly common. The lower ribs (8 through 10) are connected to each other by cartilage rather than directly to the breastbone, which gives them more freedom to move. If that cartilage loosens, one rib can slip over another. The initial sensation is a sudden, sharp, stabbing pain, sometimes with an audible click or pop. Over time, the irritated nerve running between the ribs produces a more diffuse ache that can feel like either lower chest pain or upper abdominal pain. Because the rib looks normal on a standard X-ray or CT scan, slipping rib syndrome is frequently missed. A doctor who suspects it can reproduce your symptoms with a simple test: hooking their fingers under the lower rib margin and gently lifting upward.

Kidney Problems

The right kidney sits toward the back, just below the lowest ribs. A kidney stone passing through the urinary tract often causes pain that starts in the flank and wraps around toward the front, landing in the area under the right ribs. This pain tends to be intense, comes in waves, and may be accompanied by blood in the urine, nausea, or a frequent urge to urinate. A kidney infection (pyelonephritis) produces a steadier pain in a similar location, usually with fever and back tenderness.

Lung and Chest Causes

The base of the right lung and the lining around it (the pleura) sit just above the diaphragm, close to the upper right abdomen. Pneumonia in the lower right lung can produce pain that feels like it’s coming from under the ribs rather than the chest. A blood clot in the lung, known as a pulmonary embolism, can do the same, typically with sudden-onset sharp pain that worsens with breathing, along with shortness of breath or a rapid heart rate.

Pain During Pregnancy

In later pregnancy, pain under the right ribs has an additional, more urgent possible cause. HELLP syndrome is a rare but serious complication that affects the blood and liver. Right upper abdominal pain is one of its hallmark symptoms, caused by liver swelling or even bleeding within the liver. It can develop rapidly and requires immediate medical attention. Other symptoms include severe headache, vision changes, nausea, and swelling in the face or hands.

How the Cause Is Identified

An abdominal ultrasound is the standard first step for evaluating pain under the right rib cage. It’s fast, doesn’t involve radiation, and can visualize the gallbladder, bile ducts, liver, and kidneys in a single exam. The American College of Radiology recommends ultrasound as the initial imaging test regardless of whether the suspected cause is biliary disease or something else entirely. It can confirm gallstones, detect liver enlargement, identify kidney stones, and rule out several serious conditions at once.

If ultrasound doesn’t provide a clear answer, a CT scan may follow. For suspected musculoskeletal causes, imaging often appears normal. In those cases, diagnosis relies more on physical examination and reproducing the pain through specific movements or pressure.

Signs That Need Urgent Attention

Most causes of right-sided rib pain are manageable or self-limiting. But certain combinations of symptoms suggest something more serious is happening. Pain accompanied by yellowing of the skin or eyes (jaundice) points to a problem with bile flow, possibly a blocked bile duct or acute liver disease. A high fever alongside the pain raises concern for infection in the gallbladder, liver, or kidney. Severe pain that comes on suddenly and doesn’t ease within a few hours, especially with vomiting or an inability to find a comfortable position, warrants prompt evaluation. Shortness of breath paired with right-sided rib pain could signal a pulmonary embolism, which requires immediate treatment.