One of the most important components of an atmospheric radiation scheme is its treatment of gas optical properties, which determines not only the accuracy of its radiative forcing calculations fundamental to climate prediction, but also its computational cost. This paper describes a free software tool ‘ecCKD’ for generating fast gas-optics models by optimally dividing the spectrum into pseudo-monochromatic spectral intervals (known as k-terms) according to a user-specified error tolerance and the range of greenhouse-gas concentrations that needs to be simulated. The models generated use the correlated k-distribution method in user-specified bands, but can also generate accurate ‘full-spectrum correlated-k’ models that operate on the entire longwave or near-infrared parts of the spectrum. In the near-infrared, the large spectral variation in cloud absorption is represented by partitioning the parts of the spectrum where gases are optically thin into three or more sub-bands, while allowing k-terms for the optically thicker parts of the spectrum (where clouds and surface reflectance are less important) to span the entire near-infrared spectrum. Candidate models using only 16 and 32 k-terms in each of the shortwave and longwave are evaluated against line-by-line calculations on clear and cloudy profiles. The 32-term models are able to accurately capture the radiative forcing of varying greenhouse gases including CO2 concentrations spanning a factor of 12, and heating rates at pressures down to 1 Pa.