Coronal mass ejections (CMEs) are huge expulsions of magnetized matter from the Sun and stars, traversing space with speeds of millions of kilometres per hour. Solar CMEs can cause severe space weather disturbances and consumer power outages on Earth, whereas stellar CMEs may even pose a hazard to the habitability of exoplanets. Although CMEs ejected by our Sun can be directly imaged by white-light coronagraphs, for stars this is not possible. So far, only a few candidates for stellar CME detections have been reported. Here we demonstrate a different approach that is based on sudden dimmings in the extreme ultraviolet and X-ray emission caused by the CME mass loss. We report dimming detections associated with flares on cool stars, indicative of stellar CMEs, and which are benchmarked by Sun-as-a-star extreme ultraviolet measurements. This study paves the way for comprehensive detections and characterizations of CMEs on stars, which are important factors in planetary habitability and stellar evolution.