The interaction between F atoms and crystalline Si, which is essential for etching processes in semiconductor device fabrication, is investigated with state-of-the-art theoretical techniques. The theory is based on the pseudopotential-density-functional method in a supercell geometry. A comprehensive picture of F reactions with the Si surface, the bulk, and the near-surface region is obtained, in terms of which the etching process is elucidated. Insertion of F into Si-Si bonds becomes possible because of relaxed steric constraints in the near-surface region. Dependence of the etch rate on doping follows naturally, in agreement with observations. Similarities and differences between F-Si and H-Si reactions are discussed.