We introduce a new sheaf-theoretic construction called the ideal completion of a category and investigate its logical properties. We show that it satisfies the axioms for a category of classes in the sense of Joyal and Moerdijk [17], so that the tools of algebraic set theory can be applied to produce models of various elementary set theories. These results are then used to prove the conservativity of different set theories over various classical and constructive type theories.