Numbers 8:16-20
8:16 For they are entirely given to me from among the Israelites. I have taken them for myself instead of all who open the womb, the firstborn sons of all the Israelites.
8:17 For all the firstborn males among the Israelites are mine, both humans and animals; when I destroyed all the firstborn in the land of Egypt I set them apart for myself.
8:18 So I have taken the Levites instead of all the firstborn sons among the Israelites.
8:19 I have given the Levites as a gift to Aaron and his sons from among the Israelites, to do the work for the Israelites in the tent of meeting, and to make atonement for the Israelites, so there will be no plague among the Israelites when the Israelites come near the sanctuary.”
8:20 So Moses and Aaron and the entire community of the Israelites did this with the Levites. According to all that the Lord commanded Moses concerning the Levites, this is what the Israelites did with them.