This is one of the great mysteries of the English language. Fortunately, Brian Klems at Writer’s Digest has a straightforward explanation.
A: The confusion between “who” and “whom” is one of the most common problems writers face. It can be tricky to find the correct use, and sometimes you may feel like locating the person who invented both words and smacking him upside his head. But there is a difference.
“Who” is used as the subject of a verb or complement of a linking verb. It’s a nominative pronoun. It was Carl who broke all the pencils in the house. When writing a sentence, first find the verb(s)—“was” and “broke.” Then, find the subject for each verb: “Carl” and “who.” Since “who” is a subject, it’s correct. Who needs a crayon to write this down?
“Whom” is used as the object of the verb or the object of a preposition. It’s an objective pronoun. You asked whom to the dance? In this case, the subject and verb are “You asked.” The pronoun following the verb is the object of the verb, therefore “whom” is correct. He’s already going the prom with whom? This pronoun is the object of the preposition “with,” so “whom” is the right pick. Be careful, though. Make sure the prepositional pronoun in question isn’t also a subject—if it is, then you use “who.” For example, I cheered for who played hardest. While the pronoun follows a preposition (for), it’s also the subject of the second verb (played). When placed as a subject, always use “who.”
One way to remember is to check to see which pronoun can replace the questionable word. It’s a little trick I learned back in elementary school: If it can be replaced with “he,” you use “who”; if “him” fits better, use “whom.” Sometimes you may need to split the sentence to see it. For example, It was Carl—he broke all the pencils in the house. “Who” should be used here. You asked him to the dance? “Whom” is the correct choice. This doesn’t work all the time, but when applicable, it can save you a few puzzling minutes.
And when in doubt, recast the sentence to avoid the issue altogether.