To answer your question–the best way to find out if you can tell someone or not is find out how they feel about gays. Listen to his comments about anything gay-related or gay people. See how he responds to other people when the subject of homosexuality comes up. If he seems indifferent or even mildly supportive, he may be okay to tell. Even if he isn't, if you trust him enough, go with your gut feeling. If the reaction is not what you expected, then you'll know he wasn't as much your friend as you'd thought.
I've had crushes on straight guys myself in the past. As RobinBad suggested, it's probably the most common experience for gays. In my case, my brain knew he was straight, but my desire for him clouded my judgement and made every little glance or touch he gave me seem way more important than it was. He also already knew I was gay, so I figured pretty early on that there was no way anything more could happen between us. But my crush was so strong…the way I stomped it out was to just tell him I liked him. It was embarrassing but I knew that if I did that, I'd get my direct answer and I could let that annoying little hope die. Luckily for me, he was a very polite, non judgmental and understanding guy (one of the reasons I liked him XD) and it didn't worsen our relationship. I was able to stop waiting for something to happen with him and found other people to spend time with, which took my mind off of him.
I'm not suggesting you do what I did, but you will need to ask yourself--why you want him to know this about you? Is it because you LIKE LIKE him? Or is it because you consider him a close friend and want to entrust him with an intimate detail of your life? If you like him that much, and feel that he is your best friend, you'll find a way to tell him. If your relationship is genuine, he'll find a way to accept it and you will be happy with that acceptance. It won't be easy, but it may not be as difficult as you think. Remember that your brain and heart operate differently and will give you mixed signals. It's normal to have a little hope that something more could develop between you, however unlikely it may be. Make sure that you are prepared to give that hope up.
You ARE taking a risk by telling him….but know that your friendship will be even stronger if you can tell him and he accepts you as you are.