Pyrolysis of biomass in a rotary kiln finds application both as an intermediate step in multistage gasification as well as a process on its own for the production of biochar. In this work, a numerical model for pyrolysis of lignocellulosic biomass in a rotary kiln is developed. The model is based on a set of conservation equations for mass and energy, combined with independent submodels for the pyrolysis reaction, heat transfer, and granular flow inside the kiln. The pyrolysis reaction is described by a two-step mechanism where biomass decays into gas, char, and tar that subsequently undergo further reactions; the heat transfer model accounts for conduction, convection and radiation inside the kiln; and the granular flow model is described by the well known Saeman model. The model is compared to experimental data obtained from a pilot scale rotary kiln pyrolyzer. In total 9 pilot plant trials at different feed flow rate and different heat supply were run. For moderate heat supplies we found good agreement between the model and the experiments while deviations were seen at high heat supply. Using the model to simulate various operation conditions reveals a strong interplay between heat transfer and granular flow which both are controlled by the kiln rotation speed. Also, the model indicates the importance of heat losses and lays the foundation for scale up calculations and process optimization.