Direct numerical simulation is used to study the mixing of a passive scalar by a vortex ring issuing from a nozzle into stationary fluid. The 'formation number' (Gharib et al. J. Fluid Mech. vol. 360, 1998, p. 121), is found to be 3.6. Simulations are performed for a range of stroke ratios (ratio of stroke length to nozzle exit diameter) encompassing the formation number, and the effect of stroke ratio on entrainment and mixing is examined. When the stroke ratio is greater than the formation number, the resulting vortex ring with trailing column of fluid is shown to be less effective at mixing and entrainment. As the ring forms, ambient fluid is entrained radially into the ring from the region outside the nozzle exit. This entrainment stops once the ring forms, and is absent in the trailing column. The rate of change of scalar-containing fluid is found to depend linearly on stroke ratio until the formation number is reached, and falls below the linear curve for stroke ratios greater than the formation number. This behaviour is explained by considering the entrainment to be a combination of that due to the leading vortex ring and that due to the trailing column. For stroke ratios less than the formation number, the trailing column is absent, and the size of the vortex ring increases with stroke ratio, resulting in increased mixing. For stroke ratios above the formation number, the leading vortex ring remains the same, and the length of the trailing column increases with stroke ratio. The overall entrainment decreases as a result.