Usually, pencil beam kernels for photon beam calculations are obtained by Monte Carlo calculations. In this paper, we present a method to derive a pencil beam kernel from measured beam data, i.e. central axis depth doses, phantom scatter factors and off-axis ratios. These data are usually available in a radiotherapy planning system. The differences from other similar works are: (a) the central part of the pencil beam is derived from the measured penumbra of large fields and (b) the dependence of the primary photon fluence on the depth caused by beam hardening in the phantom is taken into account. The calculated pencil beam will evidently be influenced by the methods and instruments used for measurement of the basic data set. This is of particular importance for an accurate prediction of the absorbed dose delivered by small fields. Comparisons with measurements show that the accuracy of the calculated dose distributions fits well in a 2% error interval in the open part of the field, and in a 2 mm isodose shift in the penumbra region.