In this paper, a stochastic and a deterministic SIS epidemic model with isolation and varying total population size are proposed. For the deterministic model, we establish the threshold R 0. When R 0 is less than 1, the disease-free equilibrium is globally stable, which means the disease will die out. While R 0 is greater than 1, the endemic equilibrium is globally stable, which implies that the disease will spread. Moreover, there is a critical isolation rate δ *, when the isolation rate is greater than it, the disease will be eliminated. For the stochastic model, we also present its threshold R 0 s . When R 0 s is less than 1, the disease will disappear with probability one. While R 0 s is greater than 1, the disease will persist. We find that stochastic perturbation of the transmission rate (or the valid contact coefficient) can help to reduce the spread of the disease. That is, compared with stochastic model, the deterministic epidemic model overestimates the spread capacity of disease. We further find that there exists a critical the stochastic perturbation intensity of the transmission rate σ *, when the stochastic perturbation intensity of the transmission rate is bigger than it, the disease will disappear. At last, we apply our theories to a realistic disease, pneumococcus amongst homosexuals, carry out numerical simulations and obtain the empirical probability density under different parameter values. The critical isolation rate δ * is presented. When the isolation rate δ is greater than δ *, the pneumococcus amongst will be eliminated.