Pain Under My Ribs: Causes and When to Worry

Pain under your ribs usually comes from the muscles and cartilage of the chest wall itself, not from an internal organ. Musculoskeletal causes account for 20% to 50% of all chest and rib pain cases seen in primary care. But because this area sits directly over your liver, gallbladder, spleen, stomach, and kidneys, the pain can also signal something deeper. Where exactly you feel it, what makes it worse, and how long it’s lasted are the best clues to narrowing down the cause.

Chest Wall Pain: The Most Common Culprit

The most likely explanation for pain under your ribs is inflammation or strain in the structures that make up the rib cage itself. Two conditions stand out.

Costochondritis is inflammation where the rib cartilage connects to the breastbone. It accounts for 6% to 13% of all chest pain visits in primary care. The pain is sharp or aching, often affects more than one rib, and typically hits the left side of the chest. It gets worse when you take a deep breath, cough, sneeze, or twist your upper body. Because it sits on the left side and can radiate to the arms and shoulders, people sometimes mistake it for a heart problem. The key difference: you can usually reproduce the pain by pressing on the sore spot.

Intercostal muscle strain affects the muscles that run between your ribs. It tends to follow a specific event like heavy lifting, a hard cough, or an awkward twist. The pain is localized to one area, worsens with movement, and often feels tender to the touch. Both costochondritis and muscle strains improve on their own over days to weeks with rest and over-the-counter anti-inflammatory medication.

Pain on the Right Side

Your liver, gallbladder, and right kidney all sit beneath the right side of the rib cage. Pain here that doesn’t match a musculoskeletal pattern deserves closer attention.

Gallbladder and Gallstones

Your body digests fatty foods by releasing bile from the liver and gallbladder into the small intestine through the bile duct. When a gallstone blocks that duct, the result is biliary colic: a cramping or squeezing pain under the right ribs that often starts after a fatty meal. The pain can last anywhere from 30 minutes to several hours and may radiate to the right shoulder blade. If bile builds up behind the blockage, the gallbladder can become inflamed or infected, at which point the pain becomes constant and more severe, sometimes with fever.

Liver Inflammation

Hepatitis, or inflammation of the liver, can cause a dull ache or fullness under the right ribs. It progresses slowly and some people have no pain at all in the early stages. Viral infections, heavy alcohol use, and fatty liver disease are the most common triggers. The pain tends to be persistent rather than sharp, and it may come with fatigue, nausea, or yellowing of the skin.

Kidney Stones and Infections

The kidneys sit just below the rib cage toward the back. A kidney stone that gets stuck can cause severe, wave-like pain under the ribs that radiates toward the groin. A urinary tract infection that spreads upward to the kidneys (called pyelonephritis) can also cause pain under the right ribs, usually paired with fever, chills, and painful urination.

Pain on the Left Side

The left side of the rib cage shelters your spleen, the upper part of your stomach, and a sharp bend in your colon. Each can produce distinct pain patterns.

Stomach and Peptic Ulcers

Peptic ulcers are open sores on the stomach lining or the upper part of the small intestine. They produce a burning or gnawing sensation that can extend from the belly up to the left ribs. The pain from stomach ulcers tends to come and go, and eating may either trigger or relieve it. Ulcers in the upper small intestine cause more constant pain. Common drivers include smoking, alcohol, and infection with a specific stomach bacterium. Gastritis, a broader inflammation of the stomach lining, can produce similar discomfort and sometimes leads to ulcer formation over time.

Trapped Gas in the Colon

Your large intestine makes a sharp bend just below the left rib cage called the splenic flexure. Gas normally passes through this curve without trouble, but when too much gas builds up, it can get trapped at the bend. Think of water rushing toward a sharp curve in a river during a heavy rain. The result is bloating, pressure, and sometimes a surprisingly intense pain under the left ribs that eases once the gas passes. Some people are born with an unusually tight bend in the colon, making this a recurring issue. The pain can feel alarming but typically resolves on its own or with gentle movement and the passage of gas.

Slipping Rib Syndrome

This lesser-known condition happens when the cartilage connecting two of the lower ribs loosens and becomes unstable. One rib slips in and out of place, irritating the nerve that runs between the ribs. It causes a clicking or popping sensation along with sharp pain that flares with certain movements. Slipping rib syndrome is often misdiagnosed or overlooked because it doesn’t show up on standard imaging. A provider can check for it with a simple hands-on test: hooking their fingers under the lower edge of your rib cage and gently lifting upward. If this reproduces your pain (and sometimes the pop), it confirms the diagnosis.

Lung-Related Rib Pain

Your lungs are surrounded by two thin layers of tissue called the pleura. When these layers become inflamed, a condition called pleurisy, they rub against each other like two pieces of sandpaper every time you breathe. This produces a sharp, stabbing pain that worsens when you inhale, cough, or sneeze. The distinctive feature of pleurisy is that the pain lessens or stops entirely when you hold your breath. It can also spread to your shoulders or back. Pleurisy usually develops after a respiratory infection but can also follow a blood clot in the lung or other lung conditions.

How to Tell These Apart

The nature of the pain and what changes it are the most useful clues:

  • Reproducible with touch or pressing: most likely musculoskeletal (costochondritis, muscle strain, or slipping rib syndrome)
  • Worse after fatty meals: points toward gallbladder problems
  • Burning that changes with eating: suggests a stomach ulcer or gastritis
  • Sharp pain that stops when you hold your breath: characteristic of pleurisy
  • Severe flank pain radiating to the groin: kidney stone
  • Bloating and pressure that resolves with passing gas: trapped gas at the splenic flexure

When Rib Pain Needs Urgent Attention

Most pain under the ribs is not an emergency, but certain combinations of symptoms change that picture. Seek immediate care if your rib pain comes with shortness of breath that’s getting worse, chest pain that keeps intensifying, pain in your abdomen or shoulder following an injury, or if you’re coughing up blood. Pain after a serious accident like a car crash also warrants urgent evaluation, even if the pain seems mild at first, because rib fractures can damage underlying organs without obvious external signs. A chest X-ray can identify fractures, and a CT scan provides more detailed information when the injury involves high-energy trauma.