Who, whoever, whom, and whomever are pronouns— words that take the place of a noun in a sentence. The difference between who and whom is what part of the sentence they replace.
Who and whoever are subjective-case nouns, which simply means that they are used as substitutes for subjects in a sentence.

For example:
He tells that story to whoever will listen.  Whoever is the subject of will listen.

Whom and whomever are objective-case nouns, which means that they take the place of an object in a sentence. Because of this, whom and whomever are often (but not always) found after a preposition (to, of, with, about, for, from, etc.).

For example:
The board will probably approve of whomever we select.  Whomever is the direct object, receiving the action “approve.”

Who/whoever and whom/whomever are used in two main functions:

Relative or Subordinate Clauses

In these sentences, who/whoever or whom/whomever introduce subordinate (or dependent) clauses – phrases that can’t exist without the rest of the sentence.

For example:
Salvador Dalí was an artist who took great delight in shocking his contemporaries.
“who took great delight in shocking his contemporaries” is the dependent clause – if you use it without the first part of the sentence, it will be a fragment: an incomplete sentence.
OR
You will meet with our senior engineers, whom you will meet later.
“whom you will meet later” is the dependent clause – if you use it without the first part of the sentence, it will be a fragment, an incomplete sentence.

Interrogative Pronouns (in Questions)
When used as an interrogative pronoun, who/whom usually begins a sentence.
For example:
Who left the window open? OR Whom is the teacher speaking to now?

To choose between who and whom: Is the word performing the action?  Use who.  Is it receiving the action?  Use whom. Note that this difference is not, as some people assume, a difference in levels of formality.

 

Whomever and Whoever

The use of whomever and whoever is largely based upon the subject and verb of the sentence.

Rule One

            To determine whether to use whoever or whomever follow this rule:

  • Him + he = whoever
    • Give it to whomever/whoever asks for it first.
    • Give it to him. He asked for it first.
  • Him + him = whomever
    • We will hire whomever/whoever you recommend.
    • We will hire him. You recommended him.

Rule Two

            When the entire clause is the subject of the verb that follows the clause, look inside the clause to determine whether to use whoever or whomever

  • Whoever/whomever is elected will serve a four year term.
    • Whoever is elected is the subject of will serve.
    • Whoever is the subject of is.