The adsorption and detachment processes of n-dodecane (C12H26) molecules were studied on silica surfaces with variable surface chemistry (Q2, Q3, Q4environments), using molecular dynamics simulations. The area density of the silanol groups varied from 9.4 to 0 per nm2. The shrinking of the oil–water–solid contact line was a key step for the oil detachment, due to water diffusion on the three-phase contact line. The simulation results showed that oil detachment was easier and faster on a perfect Q3silica surface which had (≡Si(OH))-type silanol groups, due to the H-bond formation between the water and silanol groups. When the surfaces contained more Q2crystalline type which had (≡Si(OH)2)-type silanol groups, less oil detached, due to the formations of H-bonds among the silanol groups. There were no silanol groups on the Si-OH 0 surface. Water cannot diffuse on the water–oil–silica contact line, and oil cannot detach from the Q4surface. The detachment efficiency of oil from the silica surface not only depended on the area density, but also on the types of silanol groups. The density and type of silanol groups depend on the crystal cleavage plane, particle size, roughness, and humidity.