Summary:The main features of a three-dimensional (3-D) Monte Carlo software system (Mc3D), designed for the simulation of electron scattering and image contrast in a scanning electron microscope, are reported. Before simulating electron trajectories in the sample, impingement of the incident electron beam is described by introducing the idea of a virtual scan path in 3-D space. A general and concise algorithm is given for simulating the intersection of electron trajectories leaving the sample onto multidetector entrance apertures distributed in 3-D space. By optimising the object-oriented design in conjunction with the use of a process-oriented and data-oriented code structure, Mc3D is capable of simulating microscopic analysis of a sample with a 3-D geometry or structure that can be expressed with formulae. Three examples of the use of Mc3D are given. The first is for linescans across a block of SiO 2 on top of a Si substrate; the second is for a stripe of SiO 2 embedded in a Si substrate. Finally, the simulation of Auger linescans across an Au overlay on Si is compared with experimental results. The relationships between experimental linescans and the true beam impact positions on the sample are revealed through the virtual scan path. An edge effect, parallel-edge enhancement, is predicted when the incident electron beam size, the distance of impact position to the terrace edge, and the inelastic mean free path of the Auger electron from a given element are comparable, and the linescan is parallel to the terrace edge. All three examples demonstrate the sensitivity of image contrast to the disposition of the sample with respect to the electron column and the detector position.