On the basis of the RHESSI results it has been suggested that terrestrial gamma flashes (TGFs) are produced at very low altitudes. On the other hand some of the Burst and Transient Source Experiment (BATSE) spectra show unabsorbed fluxes of X rays in the 25–50 keV energy range, indicating a higher production altitude. To investigate this, we have developed a Monte Carlo code for X-ray propagation through the atmosphere. The most important features seen in the modeled spectra are (1) a low-energy cutoff which moves to lower energies as TGFs are produced at higher altitudes, (2) a high-energy cutoff which moves to lower energies as TGFs are observed at larger zenith angles, and (3) time delays are observed for TGFs produced at ≤20 km (and some at 30 km) altitude when observed at larger zenith angle than the half-angle defining the initial isotropic X-ray beam. This is a pure Compton effect. The model results and an optimization procedure are used to estimate production altitudes of the BATSE TGFs. The main findings are (1) half or more of the BATSE TGFs are produced at low altitudes, ≤20 km, (2) a significant portion of the BATSE TGFs are produced at higher altitudes, 30 km to 40 km, (3) for the TGFs produced at ≤20 km (and some at 30 km) altitudes the dispersion signatures can be explained as a pure Compton effect, and (4) the softening of the BATSE spectra for increasing zenith angles and the time dispersions both indicate that the initial TGF distribution is beamed.