This paper reports a combined experimental and numerical study of the flow over a rigid airfoil in flapping motion. The setup consists of a heaving and pitching airfoil at a moderate Reynolds number (Re=500−3600), at a Strouhal number St = 0.1. The aim is to assess the accuracy of two-dimensional direct numerical simulations in predicting aerodynamic forces in a flow configuration, which is nominally two-dimensional but is at the verge of three-dimensionality. The assessment is carried out with experiments, including flow field and aerodynamic force measurements with particle image velocimetry and a load cell. The comparative study shows a good qualitative agreement between the experiments and the simulations at comparable Reynolds numbers both in terms of forces and flow fields, but with some quantitative differences. The quantitative discrepancies between experiments and simulation are analyzed and reduced to inherent differences between experimental and computational setups. It is observed that the significant differences are apparent almost exclusively in the wake evolution. Nonetheless, this is shown to have a minor effect on the aerodynamic force estimation. Overall, the trends observed when varying the mean pitch angle and the pitching amplitude are the same in both experiments and simulations. This suggests that two-dimensional/three-dimensional effects do not alter significantly the relationship between the unsteady flow mechanisms (i.e. leading edge vortex) and the aerodynamic forces in the parametric range considered here.