Using piezoresponse force microscopy in ultra-high vacuum, polarization switching has been detected and quantified in epitaxial BiFeO 3 films from 200 unit cells down to about 4 unit cells thick. Local remnant piezoresponse was utilized to probe both ferroelectric properties as well as the effects of imperfect electrical contacts. It was found that the shape of the electromechanical hysteresis loops is strongly influenced by an extrinsic dielectric gap, primarily through the suppressing effect of the depolarizing field on the spontaneous polarization in the ultrathin films. Furthermore, statistical analysis of hysteresis loops has revealed lateral variation of the extrinsic dielectric gap with sub-10 nm resolution. Robust and reproducible ferroelectric properties of nanoscale BiFeO 3 indicate its potential for nanoscale applications in information storage and spintronics.