We take advantage of an analytic model of galaxy formation coupled to the merger tree of an N-body simulation to study the roles of environment and stellar mass in the quenching of galaxies. The model has been originally set in order to provide the observed evolution of the stellar mass function as well as reasonable predictions of the star formation rate-stellar mass relation, from high redshift to the present time. We analyse the stellar mass and environmental quenching efficiencies and their dependence on stellar mass, halo mass (taken as a proxy for the environment) and redshift. Our analysis shows that the two quenching efficiencies are redshift, stellar and halo mass dependent, and that the halo mass is also a good proxy for the environment. The environmental quenching increases with decreasing redshift and is inefficient below log M * ∼ 9.5, reaches the maximum value at log M * ∼ 10.5, and decreases again, becoming poorly efficient at very high stellar mass (log M * 11.5). Central and satellites galaxies are mass quenched differently: for the former, the quenching efficiency depends very weakly on redshift, but strongly on stellar mass; for the latter, it strongly depends on both stellar mass and redshift in the range 10 log M * 11. According to the most recent observational results, we find that the two quenching efficiencies are not separable: intermediate mass galaxies are environmental quenched faster, as well as intermediate/massive galaxies in more massive haloes. At stellar masses lower than log M * 9.5 both quenching mechanisms become inefficient, independently of the redshift.