Why Do I Have Pain on My Right Side Under My Ribs?

Pain under your right ribs typically comes from one of several organs packed into that area: the gallbladder, liver, right kidney, or the bend in your large intestine. Less commonly, it originates from the muscles and cartilage of the rib cage itself or from inflammation around the right lung. The cause usually becomes clearer once you notice when the pain hits, how long it lasts, and what makes it better or worse.

Gallstones and Gallbladder Problems

The gallbladder is the most common culprit behind sudden pain in this area. It sits tucked just beneath the liver, directly under your right ribs, and its job is to store bile and release it when you eat. When gallstones block the duct that drains bile, the result is a sudden, rapidly intensifying pain in the upper right abdomen that can also radiate to your back between the shoulder blades or into your right shoulder. This pain typically lasts anywhere from several minutes to a few hours.

Gallbladder attacks often strike after meals, especially fatty ones, because eating triggers the gallbladder to contract and squeeze out bile. If a stone is lodged in the way, that contraction creates intense pressure. The pain usually comes in waves rather than staying constant, and you may feel nauseous or vomit during an episode. Between attacks, you might feel completely fine, which is part of why people put off getting it checked.

If a gallstone stays stuck long enough, the gallbladder can become inflamed or infected. At that point the pain becomes constant rather than coming and going, and you may develop a fever. A blocked bile duct can also trigger pancreatitis, since the same duct system drains the pancreas. When that happens, the pain spreads to the upper belly and into the back and tends to worsen after eating.

Trapped Gas in the Colon

Your large intestine makes a sharp turn just under your right ribs, a bend called the hepatic flexure. Gas can collect at this turn, and when it does, the pressure and distension mimic more serious conditions. Johns Hopkins Medicine notes that gas trapped on the right side of the colon can feel remarkably similar to gallstone pain or even appendicitis. The key differences: gas pain tends to shift location, comes and goes more quickly, and often improves after passing gas or having a bowel movement. If you notice the pain mostly after eating gas-producing foods or carbonated drinks, this is a likely explanation.

Liver Swelling and Inflammation

The liver itself doesn’t have pain receptors inside it, but it’s wrapped in a thin capsule that does. When the liver swells from infection, fatty liver disease, or other causes, it stretches that capsule, producing a dull ache or sense of fullness under the right ribs. This is sometimes called hepatic distension syndrome. The pain is usually constant rather than sharp, and it can also show up as referred pain along the lower ribs or into the right shoulder, because the same nerves that serve the liver capsule also run along the lower rib cage and the tissue lining the lungs.

Liver-related pain tends to develop gradually over days or weeks rather than hitting suddenly. You might also notice fatigue, loss of appetite, or a yellowish tint to your skin or eyes. Conditions like hepatitis, alcohol-related liver damage, and nonalcoholic fatty liver disease can all enlarge the liver enough to cause this kind of discomfort.

Kidney Stones on the Right Side

A stone forming in or passing through the right kidney produces pain that starts in the flank, the area between your lower ribs and hip on your back. As the stone moves down the ureter toward the bladder, the pain typically radiates forward into the abdomen, then down into the pelvis and groin. This progression helps distinguish kidney pain from gallbladder or liver pain, which stays higher up.

Kidney stone pain is notoriously intense and comes in waves as the ureter spasms around the stone. You may also notice blood in your urine, a frequent urge to urinate, or nausea. The pain doesn’t respond to changes in position: unlike gas pain or musculoskeletal pain, you can’t find a comfortable way to sit or lie down.

Rib and Chest Wall Pain

Sometimes the pain isn’t coming from an organ at all. Costochondritis, an inflammation of the cartilage connecting your ribs to your breastbone, can cause sharp pain along the rib cage that worsens with deep breathing, coughing, sneezing, or any movement of the chest wall. The hallmark is that the pain is reproducible by pressing on the spot where it hurts. If pushing on a specific area of your rib cage recreates the same pain, the source is likely musculoskeletal rather than internal.

A pulled intercostal muscle (the small muscles between your ribs) causes similar symptoms, typically after heavy lifting, twisting, or a bout of intense coughing. This kind of pain is positional: it changes depending on how you move or breathe, whereas organ pain is usually independent of body position.

Lung and Pleural Inflammation

Pleurisy is an inflammation of the thin membrane surrounding your lungs. When it affects the right side, it causes a sharp, stabbing chest pain under the ribs that gets noticeably worse when you breathe in, cough, or sneeze. The pain lessens or stops entirely when you hold your breath, which is a distinctive clue. You may also find yourself taking shallow breaths to avoid triggering it, leading to a feeling of shortness of breath.

Pleurisy can develop after a respiratory infection, pneumonia, or, less commonly, a blood clot in the lung. If you’ve recently been sick with a cough or fever and now have sharp pain that tracks with your breathing, this is a strong possibility.

What Doctors Look For

When you see a doctor for right-sided rib pain, the first imaging test is almost always an abdominal ultrasound. The American College of Radiology considers it the standard starting point for right upper quadrant pain, particularly when gallbladder disease is suspected. Ultrasound is fast, painless, involves no radiation, and is excellent at spotting gallstones, bile duct blockages, and liver abnormalities.

If the ultrasound doesn’t explain the pain, a CT scan with contrast is the usual next step. CT is better at revealing kidney stones, pancreatic inflammation, intestinal problems, and issues the ultrasound might miss. In some cases, an MRI with a special protocol for the bile ducts may be ordered to get a more detailed look at the biliary system.

Signs That Need Urgent Attention

Most right-sided rib pain turns out to be something manageable, but certain patterns warrant an emergency room visit. Pain so severe it interrupts your ability to function, pain paired with uncontrollable vomiting or an inability to keep liquids down, or pain accompanied by fever and a rapid pulse all point to conditions that can worsen quickly, including a gallbladder infection, pancreatitis, or appendicitis. Yellowing of the skin or eyes alongside pain suggests a blocked bile duct that needs prompt treatment.

If you’ve had similar episodes before but this one feels different, more intense, longer lasting, or accompanied by new symptoms, that change itself is a reason to seek care. Pain that has been gradually worsening over weeks deserves evaluation too, even if it never reaches the level of an emergency, because conditions like fatty liver disease and chronic gallbladder problems are far easier to manage when caught early.