Porous nanomasks have been prepared in situ on an insulating silicon wafer by anodization of an aluminum film grown on it. Ultra-thin nanomasks, around 50 nm thick, were fabricated by utilizing a stop signal, a vivid color appearing at the air-electrolyte interface, and the process involved showed excellent repeatability. Finally, 2D nanoscale p-n junction arrays were fabricated on a silicon on insulator (SOI) wafer using the ultra-thin nanomasks prepared. The experimental results are in good agreement with the simulated results on the characteristics of the anodization process involved.