Context : Observations indicate that the ‘ quiet ’ solar photosphere outside active regions contains considerable amounts of magnetic energy and magnetic flux , with mixed polarity on small scales . The origin of this flux is unclear . Aims : We test whether local dynamo action of the near-surface convection ( granulation ) can generate a significant contribution to the observed magnetic flux . Methods : We have carried out MHD simulations of solar surface convection , including the effects of strong stratification , compressibility , partial ionization , radiative transfer , as well as an open lower boundary . Results : Exponential growth of a weak magnetic seed field ( with vanishing net flux through the computational box ) is found in a simulation run with a magnetic Reynolds number of about 2600 . The magnetic energy approaches saturation at a level of a few percent of the total kinetic energy of the convective motions . Near the visible solar surface , the ( unsigned ) magnetic flux density reaches at least a value of about 25 G . Conclusions : A realistic flow topology of stratified , compressible , non-helical surface convection without enforced recirculation is capable of turbulent local dynamo action near the solar surface .