I tried to find everything that the bible mentions about baptism and I have found only three things that are necessary to be baptized.
1. Repent of sins
Acts 2:38, 19:4 (38 Peter replied, “Repent and be baptized, every one of you, in the name of Jesus Christ for the forgiveness of your sins. And you will receive the gift of the Holy Spirit. 4 Paul said, “John’s baptism was a baptism of repentance. He told the people to believe in the one coming after him, that is, in Jesus.”)
Mark 1:4 ( And so John the Baptist appeared in the wilderness, preaching a baptism of repentance for the forgiveness of sins.)
Luke 3:3 (He went into all the country around the Jordan, preaching a baptism of repentance for the forgiveness of sins.)
2. Confess their sins
Matthew 3:6 (Confessing their sins, they were baptized by him in the Jordan River.)
Mark 4:5 (The whole Judean countryside and all the people of Jerusalem went out to him. Confessing their sins, they were baptized by him in the Jordan River.)
3. Need to believe
Acts 19:4 (Paul said, “John’s baptism was a baptism of repentance. He told the people to believe in the one coming after him, that is, in Jesus.”) All verses from the NIV.