We present a new algorithm for computing globally optimal topology and trajectory jointly for 2D planar linkages. Planar linkage structures can generate complex end-effector trajectories using only a single rotational actuator, which is very useful in building low-cost robots. We address the problem of searching for the optimal topology and geometry of these structures and present new optimization methods that consider topology changes that are non-smooth and non-differentiable. We formulate this problem as a mixed-integer convex programming (MICP) problem for which a global optimum can be found using the branch-andbound (BB) algorithm. As a result, within a finite amount of time, our method can find planar linkage structures with end-effector trajectories that closely match the user-specified target trajectories. We tested our method to search for planar linkages with 5 − 7 rigid bodies. Compared with sampling-based methods or simulated annealing, our method improves the quality of the solution by at most 7× and the optimized planar linkage structure has been tested on a 4-legged walking robot.