Context. The evolution of intermediate and low-mass stars on the asymptotic giant branch is dominated by their strong dust-driven winds. More massive stars evolve into red supergiants with a similar envelope structure and strong wind. These stellar winds are a prime source for the chemical enrichment of the interstellar medium. Aims. We aim to (1) set up simple and general analytical expressions to estimate mass-loss rates of evolved stars, and (2) from those calculate estimates for the mass-loss rates of the asymptotic giant branch, red supergiant, and yellow hypergiant stars in our galactic sample. Methods. The rotationally excited lines of carbon monoxide (CO) are a classic and very robust diagnostic in the study of circumstellar envelop...