Right-side pain under the ribs that appears or worsens when you lie down usually traces to an organ in the right upper abdomen responding to the shift in pressure, blood flow, or mechanical stress that comes with going horizontal. The gallbladder, liver, and lower ribs themselves are the most frequent culprits, but the list runs longer than most people expect. What makes positional pain tricky is that lying down changes several things at once: it redistributes blood volume into the torso, shifts the weight of abdominal organs, and removes the gravitational drainage that keeps stomach acid where it belongs.
Gallbladder Problems Are the Most Common Culprit
The gallbladder sits tucked against the underside of the liver, right beneath the lower ribs on your right side. When something goes wrong with it, the pain tends to land exactly where you’d point if someone asked “where does it hurt under your ribs?” Gallstones are the classic trigger. A stone lodges in the neck of the gallbladder or in the duct leading out of it, blocking bile from draining. The gallbladder contracts against the obstruction, pressure builds, and the result is what doctors call biliary colic: a deep, squeezing pain in the right upper quadrant that can last hours and is often kicked off by a fatty meal.1PubMed Central. ABC of the upper gastrointestinal tract. Upper abdominal pain: Gall bladder
Lying down can make this worse for a couple of reasons. When you’re upright, gravity helps bile flow downward through the ducts. In a horizontal position, that assistance disappears, and a marginal blockage becomes a full one. On top of that, lying on your right side can compress the gallbladder directly against the liver and rib cage, increasing the pain. Many people with gallbladder trouble notice the pain hits hardest at night, especially if they ate a rich dinner and then went to bed.
Gallstones aren’t the only gallbladder problem that causes this pattern. There’s a condition called gallbladder dyskinesia, where the gallbladder contracts too weakly (or, less commonly, too forcefully) even though no stones are present. The pain feels the same as biliary colic: episodic right upper quadrant pain triggered by fatty foods.2PubMed Central. Severe Gallbladder Dyskinesia With 2% Ejection Fraction: A Comprehensive Clinicoradiologic and Pathologic Case Correlation In hyperkinesia, the opposite problem, the gallbladder squeezes too hard and causes a similar presentation.3PubMed Central. Biliary Hyperkinesia: An Overlooked Cause of Right Upper Quadrant Pain Both versions are easily missed because an ultrasound looking for stones comes back clean, leading patients and sometimes doctors to assume the gallbladder is fine.
Liver Congestion and the Capsule That Registers Pain
The liver itself doesn’t have many pain-sensing nerves inside it, which is why many liver diseases are painless until they’re advanced. But the liver is wrapped in a thin, tight membrane called the Glisson capsule, and that capsule is loaded with nerve endings. Anything that makes the liver swell stretches the capsule, and stretching it hurts.
One of the more common reasons for this kind of swelling is congestive hepatopathy, which happens when the heart isn’t pumping blood forward efficiently and blood backs up into the liver. The increased blood volume makes the liver enlarge, and because the capsule can only stretch so far, tension builds. Published case series describe the resulting pain as a mild to moderate right upper quadrant ache, often accompanied by a feeling of fullness or early satiety.4PubMed Central. From congestive hepatopathy to hepatocellular carcinoma, how can we improve patient management?
Lying down plays directly into this. When you stand or sit, gravity pulls blood into your legs. When you lie flat, that blood redistributes into the central circulation, and more of it reaches the liver. For someone whose liver is already congested, this extra volume is enough to push pain from tolerable to noticeable. People with heart failure often describe worsening right-side rib pain at night for exactly this reason. Propping up with pillows can take some of the edge off by keeping a bit of that gravitational advantage.
Fatty liver disease is another common source of liver-related right upper quadrant discomfort. In one imaging-based study of 70 patients presenting with right upper quadrant pain, fatty liver disease was the most frequent diagnosis, found in about 39% of cases, ahead of gallstones at roughly 16%.5The Therapist. Evaluation of the Causes of Abdominal Right Upper Quadrant Pain using Ultrasound Fatty liver doesn’t always cause pain, but when the fat accumulation is enough to enlarge the liver, the same capsule-stretching mechanism applies.
Slipping Rib Syndrome and Other Musculoskeletal Causes
Not every pain under the ribs comes from an organ. Sometimes the ribs themselves are the problem. Slipping rib syndrome is a condition where the cartilage connecting your lowest ribs (the “floating” ribs, which aren’t anchored to the breastbone) becomes hypermobile. The affected rib slips under or over the one above it, pinching the intercostal nerve running between them.6PubMed Central. A Comprehensive Review of Slipping Rib Syndrome: Treatment and Management The pain is sharp, sometimes stabbing, and tends to strike with sudden movements like twisting, coughing, or rolling over in bed.
Because slipping rib syndrome hits the lower chest and upper abdomen on whichever side is affected, and because the symptoms overlap with gallbladder disease, kidney stones, and several other conditions, it gets misdiagnosed constantly. One estimate suggests it accounts for up to 5% of visits for lower chest or upper abdominal pain, yet it’s frequently missed and patients wind up going through extensive workups before anyone checks the ribs.7PubMed Central. Slipping rib syndrome presentation in a young woman The connection to lying down is mechanical: certain sleeping positions load the rib cage differently, and lying on the affected side can push the hypermobile rib into a position where it catches on its neighbor. Conversely, some people find that specific positions take pressure off the impinged nerve and ease the pain.6PubMed Central. A Comprehensive Review of Slipping Rib Syndrome: Treatment and Management
The lower ribs involved are typically the 8th, 9th, and 10th, and the syndrome can affect either side. When it’s on the right, it mimics organ pain convincingly. A case report described a patient treated with nerve-blocking procedures at exactly those rib levels (T7 through T9) for chronic right-sided pain in the lower chest and upper abdomen.8PubMed Central. Treatment of Chronic Pain Due to Slipping Rib Syndrome Using Ultrasound-Guided Intercostal Cryoneurolysis: A Case Report There’s a simple bedside test called the “hooking maneuver” where a doctor hooks their fingers under the lower rib margin and pulls outward. If this reproduces the patient’s pain with a click, it points strongly toward slipping rib syndrome.
Costochondritis, inflammation of the cartilage where the ribs attach to the breastbone, is another musculoskeletal cause. It tends to be felt more in the front of the chest and is usually diagnosed after ruling out other conditions. Lying down can aggravate it by pressing inflamed cartilage against the mattress, especially if you sleep on your front or side.
How Lying Down Affects Acid Reflux and Gas Pain
Acid reflux doesn’t immediately spring to mind when you think of right-side rib pain, but the two are more connected than they seem. The esophagus runs through the center of the chest, and when stomach acid splashes upward while you’re lying flat, the burning and discomfort can radiate into the right chest wall, especially if you lie on your right side. A study of patients with reflux found that over half of those with detectable acid exposure had reflux that occurred only while lying down.9Journal of Allergy and Clinical Immunology: In Practice. Supraesophageal Reflux: Correlation of Position and Occurrence of Acid Reflux-Effect of Head-of-Bed Elevation on Supine Reflux Elevating the head of the bed by about six inches resolved supine reflux completely in the majority of those tested.
The anatomy explains why the right side is worse for reflux. Your stomach empties toward its right side, into the duodenum. When you lie on your right, the stomach’s acid-rich contents pool near the junction where the esophagus enters, making reflux more likely. A systematic review found that sleeping on the left side was associated with measurably less acid exposure in the esophagus compared to sleeping on the right side or lying flat.10World Journal of Clinical Cases. Left lateral decubitus sleeping position is associated with improved gastroesophageal reflux disease symptoms: A systematic review and meta-analysis If your under-rib pain comes with a burning quality, tastes sour, or worsens after eating, reflux is worth considering.
Trapped gas in the hepatic flexure, the sharp bend where the large intestine passes under the liver, can also produce right-side rib pain that gets worse when you lie down. Gas rises, and when you’re lying on your right side, it tends to collect in that bend. The distension pushes against the undersurface of the liver and diaphragm, creating a crampy ache that can be surprisingly intense. Moving around, passing gas, or lying on the left side usually provides relief.
A Surprising Cause in Younger Patients
Fitz-Hugh-Curtis syndrome is one of those diagnoses that catches people off guard because the pain seems completely disconnected from the actual problem. It involves inflammation of the liver capsule caused by a pelvic infection, most often pelvic inflammatory disease. Bacteria travel from the reproductive tract to the surface of the liver, creating adhesions and sharp, pleuritic right upper quadrant pain that mimics gallbladder disease or even a pulmonary embolism. It occurs in up to about one in four patients with pelvic inflammatory disease.11PubMed. Fitz-Hugh-Curtis syndrome: a diagnosis to consider in women with right upper quadrant pain
While it mostly affects women, it has been reported in men as well. A case report described a male patient whose right upper abdominal pain was a continuous stinging and burning sensation that worsened when he inhaled deeply or got up from a lying position.12Kosin Medical Journal. A Case of Fitz-Hugh-Curtis syndrome in a male patient The positional component makes sense: the inflamed liver capsule is the same structure that hurts in congestive hepatopathy, and lying down shifts organs and stretches adhesions that tugging and gravity normally hold in place during the day. If you’re young, have had recent pelvic symptoms, and develop unexplained right-side rib pain, this is a diagnosis worth raising with your doctor.
Practical Ways to Tell These Causes Apart
You can narrow the field considerably just by paying attention to the character of the pain, what triggers it, and what else is happening in your body at the same time.
- After fatty meals: Pain that builds over 30 to 60 minutes after eating something greasy and lasts hours points toward the gallbladder, whether stones or dyskinesia.
- Sharp with movement: Pain that stabs when you twist, cough, or roll over, and that you can reproduce by pressing on a specific spot along the rib margin, suggests slipping rib syndrome or costochondritis.
- Dull ache with swelling: A heavy, constant ache associated with swollen ankles, shortness of breath, or fatigue is more consistent with liver congestion from a cardiac issue.
- Burning with sour taste: Burning that climbs into the chest, especially after eating or when lying flat, and that improves with antacids or left-side sleeping, fits acid reflux.
- Crampy and relieved by passing gas: Bloating, distension, and pain that comes and goes, shifting in intensity with position changes and bowel movements, points to trapped gas at the hepatic flexure.
These patterns overlap enough that self-diagnosis is unreliable, but they’re useful to describe to your doctor because they help guide which tests to order first. An ultrasound is typically the initial study for persistent right upper quadrant pain and can identify gallstones, liver enlargement, and sometimes fatty liver disease. If that’s unremarkable and gallbladder function is in question, a functional scan using a tracer can measure how well the gallbladder contracts. For musculoskeletal causes, imaging is often less helpful than a physical exam with specific provocative maneuvers.
When Right-Side Rib Pain Needs Urgent Attention
Most causes of positional right-side rib pain are not emergencies, but a few warrant getting checked quickly. If the pain is sudden, severe, and accompanied by fever and vomiting, acute cholecystitis (an infected or severely inflamed gallbladder) is high on the list, and it can require surgery within a day or two. Pain that comes with yellowing of the skin or eyes suggests a bile duct obstruction, which needs intervention before the backed-up bile damages the liver or triggers a dangerous infection called cholangitis.
Right-side rib pain paired with significant shortness of breath could point to something in the lung or diaphragm rather than the abdomen, including a blood clot in the lung, pneumonia involving the lower right lobe, or a pleural effusion. These are especially worth considering if the pain is worse with breathing rather than with eating or movement. Unexplained weight loss combined with right-side rib pain, particularly in someone with risk factors for liver disease, warrants imaging to look for masses.
For pain that’s been coming and going for weeks, is mild to moderate, and doesn’t have any of those alarm features, a non-urgent visit to your doctor is reasonable. Keeping a brief log of when the pain hits, what you ate beforehand, which position makes it better or worse, and how long it lasts gives your doctor far more to work with than a vague description of “it hurts on my right side at night.”
Simple Positional Adjustments That Can Help
While you’re working out the cause, a few changes to how you sleep can reduce the pain regardless of what’s behind it. Sleeping on your left side keeps the stomach’s anatomy working in your favor for reflux and takes direct pressure off the gallbladder and liver. If reflux is a contributor, elevating the entire head of your bed by about six inches (using blocks under the bed legs or a wedge pillow, not just stacking pillows under your head) has strong evidence behind it.9Journal of Allergy and Clinical Immunology: In Practice. Supraesophageal Reflux: Correlation of Position and Occurrence of Acid Reflux-Effect of Head-of-Bed Elevation on Supine Reflux Stacking pillows only bends you at the waist, which can actually increase abdominal pressure and make things worse.
For musculoskeletal pain, placing a pillow between your knees when side-sleeping helps keep the rib cage in a neutral alignment. Avoiding sleeping directly on the painful side is obvious but worth stating, since many people default to their usual position out of habit. If trapped gas is the issue, gentle movement before bed, avoiding carbonated drinks with dinner, and eating your last meal at least two to three hours before lying down can reduce how much gas accumulates in the hepatic flexure overnight.
None of these adjustments replace figuring out the underlying cause, but they can make the difference between a restless, painful night and one where you actually sleep while you’re waiting for your appointment.