Is it okay to report classmates cheating on exams? Is it acceptable or ok to report on students cheating?  Many times during a test or an exam, I have seen students in front of me either passing notes, or otherwise collaborating whenever the professor isn't looking.

I don't want to get into trouble, and I don't know if it's "alright" to rat on fellow classmates.  Part of me thinks they deserve being caught out, by virtue of trying to cheat their way through the course. However, I feel like I would get found out by other students if they were caught cheating.

What is the right course of action here? To be clear, I would never raise an accusation in the middle of an exam; it would only lead to me being ostracized by my peers.
As an instructor, I want to know if there is an environment that allows cheating. Even if the student can't provide proof or only told me afterwards or anonymously, I can take action on future exams by better proctoring, exam versioning, and seating charts.

So telling the teacher afterward would protect individual students but improve the quality of the course overall, which is a win-win.