In this paper we present a genotype representation method for improving the performance of genetic-algorithm-based optimal design and synthesis of microelectromechanical systems. The genetic algorithm uses a hierarchical component-based genotype representation, which incorporates specific engineering knowledge into the design optimization process. Each microelectromechanical system component is represented by a gene with its own parameters defining its geometry and the way it can be modified from one generation to the next. The object-oriented genotype structures efficiently describe the hierarchical nature typical of engineering designs. They also encode knowledge-based constraints that prevent the genetic algorithm from wasting time exploring inappropriate regions of the search space. The efficiency of the hierarchical component-based genotype representation is demonstrated with surface-micromachined resonator designs.