The oxidation of a hydrogen-terminated Si surface can locally be induced with a scanning tunnelling microscope (STM) operating in air or with a beam of free electrons in a controlled oxygen environment. Here, the oxidation mechanism of both processes are studied and compared. The oxidation with the STM in air depends strongly on the applied tip-substrate voltage and writing speed, but is not proportional to the tunneling current. This is in contrast to the process with a beam of free electrons. The thickness of the electron beam induced oxide is studied as a function of electron energy, electron dose, and oxygen pressure.