This paper presents a method for optimal design of compliant mechanism topologies. The method is based on continuum-type topology optimization techniques and finds the optimal compliant mechanism topology within a given design domain and a given position and direction of input and output forces. By constraining the allowed displacement at the input port, it is possible to control the maximum stress level in the compliant mechanism. The ability of the design method to find a mechanism with complex output behavior is demonstrated by several examples. Some of the optimal mechanism topologies have been manufactured, both in macroscale (hand-size) made in Nylon, and in microscale (<.5mm)) made of micromachined glass.