Micromachining technology opens up many new opportunities for optical and optoelectronic systems. It offers unprecedented capabilities in extending the functionality of optical devices and the miniaturization of optical systems. Movable structures, microactuators, and microoptical elements can be monolithically integrated on the same substrate using batch processing technologies. In this paper, we review the recent advances in this fast-emerging field. The basic bulkand surface-micromachining technologies applicable to optical systems are reviewed. The free-space microoptical bench and the concept of optical prealignment are introduced. Examples of micromachined optical devices are described, including optical switches with low loss and high contract ratio, low-cost modulators, micromechanical scanners, and the XY Z micropositioners with large travel distance and fine positioning accuracy. Monolithically integrated systems such as single-chip optical disk pickup heads and a femtosecond autocorrelator have also been demonstrated.