We describe a model for protein crystallization equilibria. The model includes four terms, (1) protein translational entropy opposes crystallization, (2) proteins are attracted to each other by a nonelectrostatic contact free energy favoring crystallization, (3) proteins in the crystal repel each other but, to a greater extent, attract counterions sequestered in the crystal, which favors crystallization, and (4) the translational entropy of the counterions opposes their sequestration into the crystal, opposing crystallization. We treat the electrostatics using the nonlinear Poisson-Boltzmann equation, and we use unit cell information from native protein crystals to determine the boundary conditions. This model predicts the stabilities of protein crystals as functions of temperature, pH, and salt concentrations, in good agreement with the data of Pusey et al. on tetragonal and orthorhombic crystal forms of lysozyme. The experiments show a weak dependence of crystal solubility on pH. According to the model, this is because the entropic cost to neutralize the crystal is compensated by favorable protein-salt interactions. Experiments also show that adding salt stabilizes the crystal. Cohn's empirical law predicts that the logarithm of solubility should be a linear function of salt. The present theory predicts nonlinearity, in better agreement with the experiments. The model shows that the salting out phenomena is not due to more counterion shielding but to lowered counterion translational entropy. Models of this type may help guide faster and better ways to crystallize proteins.