Numbers 8:16-18
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.