Funerals seem to be for the dead, but in actuality funerals are ceremonies for those that remain living after someone has passed, so it is critical that you dress appropriately. That is easier said than done. Funerals are not one-size-fits all and it is important to note the possible cultural difference that one may experience.
What you may experience at a funeral depends on the culture that is represented - Jewish, Christian, Moslem, Buddhist, Hindu, al the religions should be considered and more importantly the subsets of people within these general religious definitions that all have different kinds of funeral ceremonies. For example, funerals can be very somber event, with everyone wearing all black, lots of crying and quiet behavior, or they can start with a raucous Irish Wake where everyone gets totally drunk while watching the dead.
This tradition came about from the misunderstanding that if someone falls into a coma, they appear dead but they are not yet really dead. So the Irish wake is a time to party in hopes to wake the recently deceased with all the loud noise and carrying on, from the fate of actually being dead. You can go to an Irish wake in any clothes and no one will care. After that waiting period everyone goes to the gravesite for the burial where they are very lucky if a couple of extra people do not fall into the open grave along with the deceased. This is just one example of the extreme differences in funeral ceremonies.
There are plenty of others. It the person that died is Islamic, there may be wailing of women totally covered by Burkas, or if the funeral is Buddhist, Shinto (Japanese) or Hindu there may be a lots of chanting. Now this does not mean necessarily that you are actually in those countries representing the different heritages. You will find these different kinds of funeral ceremonies conducted in almost any major city in the world. The world is now that diverse and integrated so the key for dressing properly when you attend a funeral ceremony is to know the type of funeral rights that will be performed.
If the funeral is part of your own identified cultural heritage, you should have less of a problem, and you should both know what to do and how to dress. But what if the funeral is of a co-worker where your only experiences together have been at work-related that is a structured environment? That is not equivalent to the level of knowledge necessary to have an understanding of such a strong cultural expression as a funeral ceremony. What should you do ?
Luckily most funerals are not done without a little bit of notice to allow you to prepare, so if you are on completely unfamiliar ground, seek out a person of that cultural heritage and faith to guide you both in how to act and how to dress properly.
The person who had died is honored by your presence when their friends and family accept you into the circle of support for those that remain living. You are blessed with grace when you take the time to honor the cultural heritage of the deceased and their friends and family. As a man attending just about any funeral ceremony, you would be expected to wear a nice suit and tie of darker colors, black or dark navy blue. In almost all cases you can get away with a dark suit and tie, just if you show up for the Irish wake portion of the ceremony be prepared to take your tie off.