This paper presents a series of empirical expressions to correct the total natural gamma ray log due to well environmental factors. This correction is focussed on improving the quantification of 40 K, given its application in the computation of the clay content of the different layers crossed during drilling.To date, there are no analytical relationships that make this correction and continuously consider the different diameters of the many existing sondes. There are also no functions that continuously take into account the different combinations of media interspersed between the well walls and the sonde (casing, drill pipe, gravel pack, cement, etc.) for different measurement modes and systems, such as wireline, while drilling.To solve these shortcomings, the relationships developed in this work have cited, in addition to the different well diameters and mud densities, the diameter of the sonde and the environmental parameters as variables with any value and in any possible combination. The obvious advantage of these parametric equations is that they can easily be entered as a subroutine into any code.Unlike the existing correction methods, i.e., empirical charts and curves obtained by simulation codes based on the Monte Carlo method, the relationships developed take into account the variation of the build-up effect that the radiation undergoes as it travels from layers with a certain radioactive emission to the sonde. In addition, another difference is that the relationships generated in this work include the internal diameter of the sonde between its outer walls and the cylindrical radiation detector glass.Starting from the general relationships that consider the attenuation and build-up effects of gamma radiation when passing through a medium, the methodology consisted of establishing an effective distance for the cylindrical geometry in which the source is the well wall, particularized for each effect and each type of tool (centred and eccentred).The resulting correction factors have been contrasted with the most recognized experimental charts in the field of well logging, obtaining a very high correlation and an average deviation of around 1.5%.