I gave him a surprise party when he came back home
I gave him a surprise party when he came back home
Explanation
Use helping verb was/were according to the subject of the Passive Voice sentence.
Use 3rd form of the verb.
Then use the word “by”, to show the doer.
Then convert the subject of the Active Voice Sentence into the object of the Passive Voice sentence.
In the end, add the remaining words if there are any in the Active Voice Sentence.