You're trying to make the right impression as you knock on the door.
"Who's there?" you're asked.
What's your reply? If you've ever been unsure, read on.
Pronouns as subject complements.
-----A subject complement is a word or phrase that follows a linking verb such as is or seems; it's the that in This is that, and it's the gray in All cats seem gray. A subject complement isn't the object of a verb but something linked to the subject by the verb. The rule for subject complements is very simple: They should be in the same case as the subject they are linked to, which is, of course, the subjective case.
-----It's me and It's us break the rule, a fact that has probably generated more incredulity among grammar-school students than any other precept of "good grammar," because It's I and It's we seem impossibly unnatural to them. Grammar experts often advise breaking the rule whenever the subjective pronouns I and we seem stiff or prissy, as they do following the informal contraction It's and in many other situations. That was we waterskiing by your cabin yesterday; When you hear three knocks, it will be I; His chief victim was I -- such sentences may obey the rule, but they are idiomatically objectionable.
-----There are, of course, sentences in which obeying the rule is not idiomatically objectionable. In It was I who broke your ski, the subjective who seems to make I preferable even though in principle there need be no agreement in case between a pronoun and its antecedent. The ear has to be the judge, hence our graphic for this column (just in case you were wondering).
-----It's him and It's her cannot be defended quite as energetically, because the rule-observing It's he and It's she, though perhaps slightly stilted, are not outlandish; most careful speakers and writers do use them. It's them is perhaps more often defensible, because It's they is more than slightly stilted. Again, the ear must be the judge; That was he skiing by your house seems fine to most, but His chief victim was she seems contrary to idiom, and to a lesser extent so does That was they skiing by your house.
-----So, when asked, "Who's there?" and you want to sound natural and idiomatic, go with "It's me." But if you are eager to impress with your impeccable grammar, consider replying with "It is I."
Source: Your Dictionary