There is a version of "are you okay?" that is a greeting. Automatic, social, not really waiting for an answer. Most people who are not okay recognize this version immediately and say fine anyway because the question was not really an invitation.
Then there is the other version. The one you ask when you actually want to know. When you can see that something is wrong and you want to create a space where the person can say so if they need to. Getting that second version right is what this is about.
Why the standard version does not work
"Are you okay?" asked in passing gets "yeah I'm fine" almost every time regardless of whether the person is actually fine. The question is too easy to deflect. It asks for a yes or no and yes is always easier to give.
The people who most need to talk are also the ones most practiced at saying they are fine. They have been doing it for years. A question that can be answered with one word gives them the exit they have been using their whole lives.
How to ask in a way that opens a door
The most effective version of this question is specific and observational. Not "are you okay" but "you seem like something is on your mind lately" or "you've seemed quieter than usual the last few weeks, I just wanted to check in." This is harder to deflect because you have named something specific. They cannot say fine when you have just described something that does not look fine.
It also signals that you have been paying attention. That the question comes from genuinely noticing them rather than from social obligation. That makes it safer to answer honestly.
Make it easy to say no
End with something that removes pressure. "You don't have to talk about it if you don't want to, I just wanted you to know I noticed and I'm here" tells them two important things. That you are not demanding anything from them. And that they are not alone even if they choose not to say anything right now.
Some people need to hear that someone noticed before they can talk about it. The question plants a seed. They might not answer today. They might message you at midnight a week from now. The door you opened is still open.
What to do if they say they are fine when they are not
You cannot force someone to be honest about how they are feeling. What you can do is make one more small gesture that keeps the door open. "Okay. I'm around if anything comes up" said warmly and without pressure lets them know the offer stands without making them feel cornered.
Do not push past their first answer. Pressing after someone has deflected usually makes them close off more rather than open up. Say your piece, leave the door open, and let them come through it when they are ready.
Sending a message instead of asking in person
Sometimes a message is actually easier for both people. It gives the person space to respond in their own time without being put on the spot. unsaidit can help you write a check-in message that is warm and specific enough to feel genuine without putting pressure on the other person to respond in a particular way.