Dielectric elastomer actuators (DEAs) are a recent type of electroactive actuators, which have drawn much attention because of their properties of large deformation, fast response and high efficiency. As electrodes on dielectric elastomer (DE) films will affect the performance of DEAs, different electrode patterns have been studied in previous studies. However, the electrode patterns are mostly designed by the trial and error, limited by the designer's experience and inspirations. This paper introduces a computational method termed topology optimization for the design of electrode patterns to maximize the output displacement of DEAs. With the theoretical model of DEAs, the optimization model of electrode patterns on DE films is built and solved by the solid isotropic material with penalization (SIMP) gradient method. Two actuators are designed as examples and tested for verification. The designed motions are obtained in experiments and the results agree well with the simulations, which shows the proposed method is effective.