Protostars grow in mass by accreting material through their discs, and this accretion is initially their main source of luminosity. The resulting radiative feedback heats the environments of young protostars, and may thereby suppress further fragmentation and star formation. There is growing evidence that the accretion of material on to protostars is episodic rather than continuous; most of it happens in short bursts that last up to a few hundred years, whereas the intervals between these outbursts of accretion could be thousands of years. We have developed a model to include the effects of episodic accretion in simulations of star formation. Episodic accretion results in episodic radiative feedback, which heats and temporarily stabilizes the disc, suppressing the growth of gravitational instabilities. However, once an outburst has been terminated, the luminosity of the protostar is low, and the disc cools rapidly. Provided that there is enough time between successive outbursts, the disc may become gravitationally unstable and fragment. The model suggests that episodic accretion may allow disc fragmentation if (i) the time between successive outbursts is longer than the dynamical time-scale for the growth of gravitational instabilities (a few kyr), and (ii) the quiescent accretion rate on to the protostar is sufficiently low (at most a few times 10−7 M⊙ yr−1). We also find that after a few protostars form in the disc, their own episodic accretion events shorten the intervals between successive outbursts, and suppress further fragmentation, thus limiting the number of objects forming in the disc. We conclude that episodic accretion moderates the effect of radiative feedback from young protostars on their environments, and, under certain conditions, allows the formation of low-mass stars, brown dwarfs and planetary-mass objects by fragmentation of protostellar discs.