When your mind is racing, give it one small, physical thing to follow, like a slow breath or the feeling of your feet on the floor. You are not trying to stop the thoughts. You are giving your attention somewhere steadier to rest for a minute.
Start with one slow breath
Breathe in through your nose for a count of five, and out for a count of five. Do that four times. Counting gives the busy part of your mind a job, and a slow out-breath is something most people find settling.
If you would like something to follow, the breathing tool counts the rounds for you, with a little friend breathing along.
Name what is around you
Look around and name five things you can see, four you can touch, three you can hear. It is a simple grounding exercise: it moves your attention from the thoughts to the room you are actually in.
Put the thought somewhere
Write the loud thought down, exactly as it sounds, on paper or in a note. You do not have to solve it. Many people find a thought is easier to leave alone once it is written somewhere it will not be lost.
Move a little
Stand up, stretch, walk to another room, or step outside for two minutes. A change of position is sometimes enough to change the pace.
When it keeps happening
A racing mind now and then is part of being a person. If it is most days, or it is getting in the way of sleep, work or the people around you, that is worth talking through with a doctor or a therapist. These are small things to try in the moment, not a treatment.