On earth has 3 different meanings across 2 categories:
Adverb · Prep_phrase
used with question words to convey surprise
"what on earth are you doing?"
Expletive used for emphasis after an interrogative word.
Alternative letter-case form of on earth