This paper presents a simple model which can be used to calculate the following values: critical depth for which the well integrity is preserved in a shale or coal horizon with actual shale/coal mechanical parameters, actual mud density and reservoir parameters; minimum mud density at which stress concentration at the wellbore wall is below the allowable limit for a given rock’s mechanical parameters, formation pressure gradient, and overburden pressure gradient; mud density required for the preservation of shale/coal integrity at the wellbore wall at any depth, assuming that the strength parameters of shale or coal, formation pressure gradient, and overburden pressure gradient are constant. The appropriate equations were derived using the maximum principal strain hypothesis, which holds for brittle materials. It was also assumed that the radial pressure at the borehole wall is caused by the weight of overburden rocks. The author’s intention was to provide formulas which are as simple as possible and which can be easily used in practice. The final equations were based on the solution to the Lame problem, which was adopted to represent a vertical drilling well with a circular cross-section and filled with mud whose hydrostatic pressure is assumed to oppose the pore pressure. Included are effects of silt swelling pressure, overburden pressure, mud density and the mechanical properties of the rock – including the unconfined compressive strength and Poisson’s ratio. In the case of shale or silty coal layers, the swelling pressure increases the volume of the clay minerals in the pores by diffusion the mud filtrate, which reduces the pore volume and increases the pore pressure, and therefore impacts the calculations. Presented model allows for derivation of the Hubert–Willis formula for fracturing pressure or fracture pressure gradient, which are commonly used in the oil industry. The calculation results are presented using data from the domestic oil industry and data from one of the Polish coal mines.