The urge to text an ex is rarely about the person. It is about loneliness, unfinished emotion, or the hope that one message will change the story. This framework helps you decide with your eyes open.

Common reasons include wanting closure, feeling lonely, seeking validation, being angry, or wanting them back. The message itself is rarely the point — it is usually an attempt to soothe an unmet need.
Do not text when you have been drinking, it is late at night, you just saw upsetting social media, you want proof they regret losing you, they are in a new relationship, they asked for no contact, or the breakup involved abuse or betrayal.
Contact can make sense when you share practical responsibilities, both have had real time apart and done individual work, the breakup was mutual, or you are genuinely open to reconciliation and have reason to believe they are too.
Wait 24 hours before sending. Write the message in your notes app instead. Read it the next day. Most of the time you will be glad you did not send it. If it still feels necessary after a day, keep it short and low-pressure.
Address the need directly. If lonely, reach out to a friend. If angry, write it out or exercise. If wanting closure, write a letter you do not send. If wanting them back, ask what has actually changed. Missing someone is not the same as being good for each other.