Calcite cementation has been identified as an active process in the Upper Triassic Yanchang Formation throughout its burial history and as a major diagenetic factor causing strong reservoir heterogeneities. The origins of calcite cements and their relevance to reservoir heterogeneities were investigated using a suite of petrographic and geochemical methods, including optical microscopy with fluorescence and cathodoluminescence, scanning and backscattered electron microscopy with energy-dispersive spectrometry, x-ray diffraction, x-ray fluorescence, electron probe microanalysis, quantitative evaluation of minerals by scanning electron microscopy, fluid inclusion analysis, and carbon and oxygen stable isotope analyses. The sandstones are compositionally immature with relatively high amounts of volcanic rock fragments. The two generations of calcite cements are Ca-I and Ca-II. The Ca-I calcites are distributed along the interface of sandstone and mudstone units and were formed during the Late Triassic to Early Jurassic at formation temperatures of approximately 90°C. The Ca-II calcite mainly developed in the lower part of the fining-upward sandstone units and was formed in the Late Jurassic at higher temperatures of approximately 110°C. The origins of calcite cements were constrained by geochemical and isotope measurements, fluid inclusion homogenization temperature, and in situ element analysis. The Ca-I calcite cement originated from dissolution of the lacustrine depositional carbonates in the interbedded mudstones and reprecipitation in the adjacent sandstones. The Ca-II calcite was mainly related to organic matter decarboxylation, with Ca2+ having been provided internally by volcanic fragment alteration and plagioclase dissolution. Calcite cementation had caused strong reservoir heterogeneities in the Yanchang Formation tight sandstones. The Ca-I calcite cementation destroyed reservoir properties along the interface of sandstones and mudstones. The lower parts of the fining-upward sandstone units were tightly cemented by Ca-II calcite, although they originally had high porosity and permeability. The middle–upper parts of the fining-upward sandstone units contain less calcite cements and thus have better preserved reservoir pores because of oil emplacement inhibiting the calcite cementation processes.