One of the basic parameters of a charge coupled device (CCD) camera is its gain, that is, the number of detected electrons per output Analogue to Digital Unit (ADU). This is normally determined by finding the statistical variances from a series of flat-field exposures with nearly constant levels over substantial areas, and making use of the fact that photon (Poisson) noise has variance equal to the mean. However, when a CCD has been installed in a spectroscopic instrument fed by numerous optical fibres, or with an echelle format, it is no longer possible to obtain illumination that is constant over large areas. Instead of making do with selected small areas, it is shown here that the wide variation of signal level in a spectroscopic ‘flat-field’ can be used to obtain accurate values of the CCD gain, needing only a matched pair of exposures (that differ in their realisation of the noise). Once the gain is known, the CCD readout noise (in electrons) is easily found from a pair of bias frames. Spatial stability of the image in the two flat-fields is important, although correction of minor shifts is shown to be possible, at the expense of further analysis.