As a result of the island growth mode all epitactic YBa2Cu3O7−δ thin films show surface roughness. To investigate a possible surface pinning mechanism, combined magneto-optical and atomic force microscopy studies were carried out. Measurement of the spatial distribution of magnetic flux density on the surface of thin YBa2Cu3O7−δ films by means of the magneto-optical Faraday effect (MOFE) under application of external magnetic fields allows an accurate determination of critical current densities jc. In order to have a quantitative comparison between the Bean model for thin films and experiment, a new nonlinear calibration technique for the flux densities was developed. For determining the thickness and roughness dependence of jc, samples with YBaCuO-strips of different thickness and roughness were patterned from one film. With the roughness determined experimentally by afm measurements, a satisfactory agreement between the measured and calculated thickness dependence of jc is achieved. Surface pinning is found to cause between 10%–30% of the critical current densities of epitactic YBa2Cu3O7−δ thin films. Additionally microscopic deviations of the flux profiles from the Bean model are detected. Evidence for matching effects of the vortex line distribution with the density of surface pins is given.