Coughing that causes pain under the right rib cage may be related to muscle damage caused by severe coughing. Besides, cough and pain under right rib may also be related to lung infection, lung cancer and other diseases. 1. Muscle injury: violent coughing may lead to frequent contraction and diastolic movement of intercostal muscles, causing fatigue and injury of intercostal muscles, which may cause intercostal muscle pain, manifested as coughing and pain under right rib. 2. Lung infection: Lung infection may cause cough, sputum and other symptoms. If lung infection involves pleura, it may lead to pleurisy and chest pain, which may be manifested as cough and right subcostal pain. 3. Lung cancer: cough is one of the common symptoms of lung cancer. In the early stage of lung cancer, when the cancer cells have not metastasized and spread, it usually does not cause rib pain; when the cancer cells metastasize to ribs and other bones, it will cause rib pain and pain in other parts of bones. In order to accurately determine the cause of coughing and right rib pain, it is recommended to consult a doctor as soon as possible and analyze the cause of the coughing and right rib pain through relevant examinations, and then carry out regular treatment after identifying the cause of the coughing and right rib pain.