What Causes Pain Under the Right Rib Cage?

Pain under the right rib cage most commonly comes from the gallbladder, but several other organs sit in this area, including the liver, the right side of the colon, and the lower right lung. The cause can range from something as simple as trapped gas to something that needs urgent treatment like gallbladder inflammation. Where exactly it hurts, what makes it worse, and how long it lasts are the best clues to narrowing it down.

Gallbladder Problems

The gallbladder is the single most common source of sharp pain directly under the right rib cage. About 20 million people in the United States have gallstones, roughly 15% of the population. Most of those stones sit quietly and never cause symptoms, but around 20% eventually do, and when they do, the pain is hard to ignore.

A gallstone attack typically produces sudden, rapidly intensifying pain in the upper right abdomen that can also radiate between the shoulder blades or into the right shoulder. It often strikes after a fatty meal, when the gallbladder contracts to release bile. The pain can last anywhere from a few minutes to several hours, and nausea or vomiting frequently come along with it. If the gallbladder itself becomes inflamed (a condition called cholecystitis), the pain tends to be more constant, more severe, and may come with fever.

Ultrasound is the go-to first test when gallbladder disease is suspected, with about 96% accuracy for detecting gallstones. CT scans are actually less sensitive for stones themselves (around 75%) but better at picking up complications like inflammation or infection.

Liver-Related Causes

The liver fills most of the space under the right rib cage, and when it swells, it presses against the surrounding capsule of tissue. That capsule has nerve endings, so stretching it produces a dull, aching pain or a sense of fullness and pressure under the ribs. The liver itself doesn’t have pain receptors, which is why many liver conditions are painless until the organ enlarges enough to stretch that outer layer.

A long list of conditions can cause this swelling. The most common include viral hepatitis (types A, B, and C), fatty liver disease linked to metabolic problems or heavy alcohol use, and cirrhosis. Less common causes include genetic conditions that cause copper or iron to build up in the liver, noncancerous tumors, and liver cysts. The pain from liver enlargement tends to be steady rather than coming in waves, and it often develops gradually over weeks or months rather than hitting all at once.

Trapped Gas in the Colon

The colon makes a sharp turn just under the right rib cage at a bend called the hepatic flexure. Gas that gets trapped at this bend can produce surprisingly intense pain that mimics gallbladder disease or even appendicitis. This is sometimes called hepatic flexure syndrome, and it’s far more common than most people realize.

The key difference is that gas pain tends to shift. It may come on suddenly, feel sharp or crampy, and then ease after you pass gas or have a bowel movement. It also tends to worsen after eating large meals, consuming carbonated drinks, or swallowing a lot of air. If the pain completely resolves after passing gas, that’s a strong signal the colon was the source.

Musculoskeletal Pain

Not all pain under the right ribs comes from an organ. The ribs themselves, the cartilage connecting them to the breastbone, and the muscles between them can all be sources. Costochondritis, an inflammation of the cartilage where ribs attach to the breastbone, causes sharp or aching pain that feels like pressure. It worsens with deep breaths, coughing, sneezing, or twisting movements. While it more commonly affects the left side, it can occur on the right.

Strained intercostal muscles (the small muscles running between each rib) are another frequent culprit, especially after heavy lifting, intense exercise, or even a bad coughing spell. This type of pain is reproducible: pressing on the sore spot or moving in a specific way reliably triggers it, which helps distinguish it from organ pain. A rib fracture produces similar symptoms but with more intense, localized tenderness. Most rib fractures heal on their own in 6 to 12 weeks with pain management and reduced activity.

Lung and Breathing-Related Causes

The lower portion of the right lung sits just behind and above the right rib cage, separated from the chest wall by a thin double-layered membrane called the pleura. When this membrane becomes inflamed, a condition called pleurisy, the two layers rub against each other like sandpaper. The result is a sharp, stabbing pain that gets worse every time you breathe in and eases when you hold your breath.

Pleurisy can develop from pneumonia, a viral infection, a blood clot in the lung, or other conditions affecting the lung tissue. If right-sided rib pain clearly tracks with your breathing cycle, getting sharper on inhalation and fading when you stop breathing momentarily, the pleura is a likely source. Pneumonia in the lower right lobe can produce similar pain along with cough, fever, and shortness of breath.

How to Tell These Apart

The character of the pain gives you the most useful information before you ever see a doctor:

  • Sharp, sudden, and intense after eating: gallbladder
  • Dull ache or fullness that develops gradually: liver
  • Crampy pain that moves or resolves with passing gas: colon
  • Pain that worsens with movement or touch: musculoskeletal
  • Stabbing pain that tracks with each breath: pleurisy or lung issue

These patterns overlap, and no single feature is perfectly reliable on its own. But combining the pain quality, timing, and what makes it better or worse helps both you and your doctor focus the workup in the right direction.

Warning Signs That Need Urgent Attention

Most causes of right rib pain are not emergencies, but some are. Go to an emergency room if your pain comes with any of the following: severe or worsening intensity that doesn’t let up, fever or chills, vomiting blood, yellowing of the skin or eyes, blood in your urine or stool, shortness of breath, or pain that spreads upward toward your chest, neck, or shoulder. Unexplained weight loss alongside persistent rib pain also warrants prompt evaluation.

Pain that started mild but keeps escalating over hours deserves the same urgency, even without those other symptoms. Conditions like a gallbladder infection or appendicitis (which can occasionally refer pain upward) can progress quickly, and early treatment makes a significant difference in outcomes.