Shale gas is a typical unconventional energy source and recently has received great attention around the world. Unlike conventional natural gas, shale gas mainly exists in two forms: free state and adsorbed state. Therefore, geologists have proposed the concept of gas content. The traditional calculation methods of gas content can be summarized as on-site gas desorption, logging interpretation, isothermal adsorption, and so on. However, all of the methods mentioned above have their shortcomings. In situ gas content is a new concept in the calculation of the gas content. In this paper, the in situ gas content is defined as the gas content obtained by direct measurement of core gas production through experimental or mathematical simulation of original reservoir conditions. In this work, a method to calculate the in situ gas content of shale is provided, which includes two parts: numerical simulation of the coring process and a gas content experiment. Compared with previous gas content prediction methods, this article considers the influence of the temperature field on gas content both in mathematical modeling and experiments. Then, the gas content of the Longmaxi Formation shale in the Sichuan Basin was calculated using both methods as an example. The results show that (1) the numerical model was considered to be reliable by analyzing the effects of coring speed and permeability on the loss of gas; (2) the total gas content predicted by numerical simulation of the coring process and the gas content experiment are approximately equal, with values of 5.08 m 3 /t and 4.95 m 3 /t, respectively; (3) the total gas content of the USBM method is only 4.28 m 3 /t, which is significantly lower than the above methods. In summary, this study provides an in situ gas content prediction method for shale from both mathematical modeling and experiments. The mutual verification of theory and experiment makes this method highly reliable.