The influence of several surface preparation techniques, such as electropolishing, chemical polishing, anodizing, and firing in an UHV furnace with different cool‐down cycles, onQ0values, peak rf fields, and surface mean free pathlshave been studied in a weldedS‐band cavity having large beam tubes. With special treatments, peak fields up to 810 G atQ0≈1011have been obtained, whereas the surface mean free paths stayed fairly short(≲300 Å )not changing systematically with (surface) treatment. Hence, to obtain low rf losses and high rf fields, the purity is not important, but, as we will explain, the spatial homogeneity is very important. Measurements with Nb cylinders, processed like the cavities, showed that the variation of flux penetration depth &lgr;(Hdc) with a dc magnetic fieldHdcparallel to the cylinder surface changed markedly with surface treatment. This variation of &lgr;(Hdc) shows several features, which are related to surface properties, namely, the reversibility nearHc1and the signal atHc2as indications for roughness or oxygen in the surface sheath, the irreversibility betweenHc1andHc2as an indication for inhomogeneities, especially NbO precipitates, in a Nb surface layer. For example, by this method we observed that the usual cool down from 400 to 50°C in the UHV furnace deteriorates a Nb surface layer of several &mgr; thickness. These surface properties obtained with &lgr;(Hdc) are not only important for achieving better rf cavities but also for ac power transmission lines.