The equilibrium and nonequilibrium average charges of boron, carbon, and nitrogen ions are cal culated as functions of the carbon target thickness in a broad projectile energy range of 0.01 to 10 MeV/nucleon. The calculations are based on a method for determining the electron loss and capture cross sections in solids. The equilibrium target thickness is estimated for different energies of projectile ions.