Right costal margin pain, the ache or sharp sensation along the lower edge of your right rib cage, has a surprisingly wide range of causes. The gallbladder gets the most attention, and for good reason, but the same strip of anatomy also sits over parts of the liver, the right kidney, the lower lung, and a complicated scaffold of cartilage and intercostal nerves. That overlap means your doctor has to think through musculoskeletal problems, organ inflammation, nerve entrapment, and even infections that seem unrelated to the ribs before landing on a diagnosis.
Where Exactly Is the Right Costal Margin
The costal margin is the curved lower border of the rib cage, formed by the cartilage tips of the seventh through tenth ribs sweeping downward toward the midline. Classical anatomy textbooks describe these cartilages as fusing into a neat, continuous arch, but cadaver research tells a different story. A study published in the Journal of Trauma and Acute Care Surgery found considerable variability in how the eighth, ninth, and tenth ribs attach, and the costal margin does not form a single cartilage connection to the breastbone the way older diagrams suggest.1Journal of Trauma and Acute Care Surgery. Anatomy of the anterior ribs and the composition of the costal margin: A cadaver study That variability matters because it helps explain why the lower ribs are more prone to slipping and clicking, and why pain in this area can be difficult to pin down structurally.
On the right side, the costal margin drapes over the gallbladder and the lower edge of the liver. The right kidney sits behind it, and the base of the right lung extends down to roughly this level. Any inflammation, stretching, or mechanical irritation involving these structures can register as pain right along that bony rim.
Gallbladder and Biliary Causes
When most people, and most emergency physicians, hear “right costal margin pain,” the gallbladder is the first thing that comes to mind. Gallstone attacks typically produce a crampy, building pain just below the right rib edge that can radiate to the right shoulder blade. The pain often follows a fatty meal and lasts anywhere from thirty minutes to several hours.
Acute cholecystitis, the infection or inflammation of the gallbladder wall when a stone gets stuck, intensifies that pain and usually adds fever and nausea. The classic physical exam finding is the Murphy sign: the examiner presses under the right costal margin while you breathe in, and if the inflamed gallbladder descends onto their fingers and you catch your breath from the pain, the test is considered positive. A systematic review in JAMA found that the Murphy sign and right upper quadrant tenderness were among the more useful bedside findings, though neither was conclusive on its own.2JAMA. Does This Patient Have Acute Cholecystitis?
Not all biliary pain comes from stones. Biliary dyskinesia is a condition where the gallbladder empties poorly despite no visible stones or tumors, and it produces the same right-upper-quadrant ache beneath the costal border.3Balneo and PRM Research Journal. Non-invasive Physiotherapeutic Approaches in Biliary Dyskinesia Because imaging looks normal, patients sometimes go years being told nothing is wrong. The diagnosis usually requires a specialized nuclear medicine scan that measures how well the gallbladder contracts.
Slipping Rib Syndrome
If your right costal margin pain is sharp, stabbing, and triggered by certain movements like twisting, reaching overhead, or coughing, the problem might not be inside your abdomen at all. Slipping rib syndrome occurs when one or more of the eighth through tenth ribs become abnormally mobile, allowing the cartilage tip to slip or click under the rib above it.4PubMed Central. A Review of Slipping Rib Syndrome: Diagnostic and Treatment Updates to a Rare and Challenging Problem The pain comes from irritation of the intercostal nerve that runs along the underside of the adjacent rib.5PubMed Central. A Comprehensive Review of Slipping Rib Syndrome: Treatment and Management
This condition has a reputation for being underdiagnosed. Researchers have described it as “an often unrecognized” cause of chest and abdominal wall pain, partly because it does not show up on standard imaging like X-rays or CT scans.6PubMed. Slipping Rib Syndrome: Solving the Mystery of the Shooting Pain Diagnosis relies on a physical exam technique called the hooking maneuver: the examiner curls their fingers under the lower costal margin and pulls outward. If that reproduces the clicking sensation and your typical pain, slipping rib syndrome is the likely culprit. Dynamic ultrasound, where the technician watches the rib tips move in real time, can also confirm abnormal mobility.
The condition stems from the anatomy discussed earlier. Because the lower false ribs do not attach directly to the breastbone through their own cartilage, their tips are held in place mainly by ligaments and fibrous connections. Trauma, repetitive movement, or simply natural anatomical variation can weaken those connections enough to let a rib tip wander. Treatment ranges from nerve blocks and physical therapy to surgical stabilization or excision of the offending rib tip in stubborn cases.
Other Musculoskeletal Sources of Pain Along the Rib Edge
Slipping rib syndrome is the headline musculoskeletal cause, but it is not the only one. A review of chest-wall pain found that costochondritis (inflammation where the ribs meet the cartilage), traumatic muscle pain, and what was historically called “fibrositis” syndrome are all common contributors to pain along the rib margin.7PubMed Central. Musculoskeletal chest wall pain Direct trauma from a fall, a car accident, or even vigorous coughing can bruise or fracture the lower ribs and produce pain that tracks along the costal margin for weeks. Muscle strains of the obliques or the upper attachments of the rectus abdominis can feel deceptively similar to organ pain because the muscles anchor right along this same skeletal landmark.
The distinguishing feature of musculoskeletal pain is usually its relationship to movement and touch. Pressing on the sore spot reproduces it. Twisting, bending, or taking a deep breath makes it worse. The pain does not come with fever, jaundice, or changes in bowel habits. When those features are present, something deeper is usually going on.
When the Lungs Refer Pain Downward
Here is one that surprises people. Pneumonia or pleurisy at the base of the right lung can produce pain that feels like it is coming from the abdomen rather than the chest. A paper in JAMA noted that while pleurisy and pneumonia usually cause pain in the chest on the affected side, the pain can be referred to points remote from the disease, including the abdomen.8JAMA. ABDOMINAL PAIN IN PLEURISY AND PNEUMONIA The mechanism is shared nerve supply: the phrenic nerve and the lower intercostal nerves serve both the diaphragm and the upper abdominal wall, so irritation on one end can be felt on the other.
This is most likely to cause confusion when the lung infection is in its early stages and the cough and fever have not fully developed yet. A patient walks into an emergency department with right costal margin pain and nausea, and the initial suspicion falls on the gallbladder. A chest X-ray, sometimes ordered almost as an afterthought, reveals a right lower lobe infiltrate. If you have right-sided rib edge pain along with even mild shortness of breath or a new cough, flagging those symptoms for your doctor can help steer the workup in the right direction.
Fitz-Hugh-Curtis Syndrome
This is a cause of right costal margin pain that deserves more attention than it gets, particularly in younger women. Fitz-Hugh-Curtis syndrome is inflammation of the liver capsule that develops as a complication of pelvic inflammatory disease. It occurs in up to about one in four patients with PID and classically presents as sharp, pleuritic right upper quadrant pain that can mimic cholecystitis or even a kidney infection.9PubMed. Fitz-Hugh-Curtis syndrome: a diagnosis to consider in women with right upper quadrant pain
The tricky part is that the pelvic infection may be subtle or even silent. In a case series, the majority of patients presented with upper right abdominal pain, and some had no lower abdominal symptoms at all.10PubMed Central. Clinical outcome of Fitz-Hugh-Curtis syndrome mimicking acute biliary disease In one reported case, a woman presented with fever and right-sided chest pain worsened by deep breathing and lying on her right side; contrast CT showed liver capsule enhancement, and a cervical swab confirmed chlamydia infection.11The American Journal of Medicine. A Case of Fitz-Hugh-Curtis Syndrome Presenting with Right-Sided Chest Pain The condition responds to antibiotics, so identifying it early avoids unnecessary gallbladder surgery and clears the underlying infection before it causes further reproductive harm.
Shingles and Nerve Pain
Herpes zoster, or shingles, is caused by reactivation of the chickenpox virus in a nerve root. When it affects a thoracic dermatome on the right side, the burning, stabbing pain can wrap around the trunk and land squarely along the costal margin. What makes early shingles particularly confusing is that the pain often shows up days before the telltale blistering rash appears. During that window, the presentation can look identical to biliary or musculoskeletal pain.
A case report described a pregnant patient who presented with severe left upper quadrant pain and was only diagnosed with shingles once vesicles finally erupted in the T6 dermatome.12PubMed Central. Shingles in Pregnancy: An Elusive Case of Left Upper Quadrant Abdominal Pain The same pattern can happen on the right. The clue is often the quality of the pain: a deep, burning, or electric sensation that follows a band-like distribution from the spine around to the front, and skin that feels unusually sensitive to light touch in that strip. If you are over 50, have a weakened immune system, or are under significant stress, shingles should be on the radar when costal margin pain does not fit the usual organ-based explanations.
Pain That Persists After Gallbladder Surgery
Some people develop right costal margin pain only after their gallbladder has been removed, a frustrating scenario that can feel like the surgery did not fix anything. Post-cholecystectomy syndrome refers to the recurrence of symptoms resembling biliary pain after gallbladder removal, and it affects roughly one in ten patients who undergo the procedure.13The Surgeon. A systematic review of the aetiology and management of post cholecystectomy syndrome
The causes are a grab bag. A systematic review found that many patients actually have extra-biliary or unrelated conditions that may have been present before surgery but were attributed to the gallbladder. When the syndrome shows up within the first few years, a gastric cause like peptic ulcer disease or gastritis is the most common culprit. Later presentations are more likely due to retained or newly formed stones in the bile duct. Dysfunction of the sphincter of Oddi, the muscular valve where the bile duct empties into the small intestine, accounted for about a third of cases in one unselected population.14The Surgeon. A systematic review of the aetiology and management of post cholecystectomy syndrome If your right costal margin pain started or continued after cholecystectomy, pushing for further evaluation rather than accepting the pain as unexplained is reasonable.
When Children Have Right Costal Margin Pain
Adults are not the only ones who deal with this. Children can develop the same range of musculoskeletal and, less commonly, organ-related pain along the rib edge. Slipping rib syndrome in particular is an underappreciated cause of chest and upper abdominal pain in kids. A report of four pediatric cases found that the children were initially worked up for cardiac conditions, emotional causes, and esophagitis before anyone thought to check for a slipping rib.15PubMed. Slipping rib syndrome as a cause of chest pain in children The authors noted that the diagnosis can be made on physical examination alone, potentially saving young patients from unnecessary cardiac or gastrointestinal evaluations.
The lesson applies broadly. Because children cannot always articulate the character and location of their pain precisely, and because serious organ disease in a child feels like a diagnosis no one wants to miss, the workup tends to skip over the chest wall entirely. A simple hooking maneuver during the physical exam can short-circuit a long diagnostic odyssey.
Rare Mimics Worth Knowing About
Occasionally, right costal margin pain turns out to be something genuinely unusual. Omental torsion is one example. The omentum, the fatty apron that drapes over your intestines, can twist on itself and lose its blood supply, producing localized pain that closely imitates acute cholecystitis. A case report described a patient with omental torsion and partial tissue death in the right upper quadrant whose presentation was initially indistinguishable from gallbladder inflammation.16PubMed. Omental torsion as a rare cause of pain in the right subcostal space – a case report The condition is uncommon enough that it is almost always diagnosed during surgery or on CT imaging done for another suspected cause. Liver abscess, hepatic hemangioma bleeding, and right-sided diaphragmatic irritation from subphrenic abscess are other uncommon causes that occasionally surface.
These rare diagnoses are worth mentioning not because you should worry about them, but because they illustrate a practical point: when standard testing for gallstones and musculoskeletal causes comes back negative and the pain persists, there are still explanations to pursue. Giving up on diagnosis is not the right move.
Sorting Through the Possibilities
Given all these overlapping causes, a few features can help you and your doctor narrow things down before imaging even enters the picture:
- Timing with meals: Pain that reliably follows fatty food points toward gallbladder or biliary causes. Musculoskeletal pain has no relationship to eating.
- Relationship to movement: Pain that worsens with twisting, bending, or deep breathing and improves at rest suggests a chest wall or rib origin. Organ pain is usually constant or colicky regardless of position.
- Reproducibility on pressing: If pressing on a specific spot along the rib margin reproduces your exact pain, the source is likely in the chest wall, not inside the abdomen.
- Fever or systemic illness: Fever with right costal margin pain raises the stakes and points toward infection, whether cholecystitis, pneumonia, liver abscess, or Fitz-Hugh-Curtis syndrome.
- Skin changes: A band-like rash or unusual skin sensitivity in the area strongly suggests shingles.
- Gynecologic symptoms: Vaginal discharge, pelvic pain, or a recent sexually transmitted infection in the setting of right upper quadrant pain should prompt evaluation for Fitz-Hugh-Curtis syndrome.
Ultrasound is typically the first imaging study ordered because it is fast, radiation-free, and excellent at identifying gallstones and liver abnormalities. If the ultrasound is unrevealing and the pain continues, CT scanning, a hepatobiliary iminodiacetic acid (HIDA) scan for gallbladder function, or even dynamic ultrasound aimed specifically at rib mobility may be the next steps depending on the clinical picture. The key is matching the test to the suspected cause rather than repeating the same ultrasound that was already negative.
How Referred Pain Complicates the Picture
One of the reasons right costal margin pain is such a diagnostic puzzle is the phenomenon of referred pain. The liver, gallbladder, and diaphragm share nerve pathways with the shoulder, the mid-back, and the abdominal wall. Gallbladder inflammation is famous for sending pain to the right shoulder tip. Lower lung disease refers pain downward into the upper abdomen, as discussed earlier. And liver capsule stretching from congestion, hepatitis, or Fitz-Hugh-Curtis inflammation can register as a vague ache anywhere along the right rib edge or even in the back.
This means that looking at the pain in isolation, just the spot that hurts, can be misleading. The associated symptoms you mention (or forget to mention) during a medical visit often do more to identify the cause than the location of the pain itself. Keeping a brief mental inventory of what else is going on, even seemingly unrelated things like a new cough, changes in urine color, pelvic symptoms, or a recent respiratory illness, gives your doctor the broader context they need to avoid anchoring on the wrong diagnosis.

