In order to identify the optimal pH range for chlorinated swimming pools, the formation of trihalomethanes, haloacetonitriles and trichloramine was investigated in the pH-range 6.5-7.5 in batch experiments. An artificial body fluid analogue was used to simulate bather load as the precursor for by-products. The chlorine-to-precursor ratio used in the batch experiments influenced the amounts of by-products formed, but regardless of the ratio the same trends in the effect of pH were observed. Trihalomethane formation was reduced by decreasing pH, but haloacetonitrile and trichloramine formation increased. To evaluate the significance of the increase and decrease of the investigated organic by-products at the different pH values, the genotoxicity was calculated based on literature values. The calculated genotoxicity was approximately at the same level in the pH range 6.8-7.5 and increased when pH was 6.7 or lower. An optimal pH range for by-products formation in swimming pools was identified at pH 7.0-7.2. In the wider pH range (pH 6.8-7.5), the effect on by-product formation was negligible. Swimming pools should never be maintained at lower pH than 6.8 since formation of both haloacetonitriles and trichloramine increase significantly below this value.