We present a new methodology for designing a nonlinear rotational spring with a desired passive torque profile by using a noncircular pulley-spring mechanism. A synthesis procedure for the shape of the noncircular pulley is presented. The method is based on an infinitesimal calculus approach that leads to an analytical solution, and the method is extended to address practical design issues related to the cable routing. Based on the synthesis method, an antagonistic spring configuration is designed for bilateral torque generation and is designed such that there is no slack in the routing cables. Two design examples are presented, namely, double exponential torque generation and gravity compensation for an inverted pendulum. Experiments with a mechanism for gravity compensation of an inverted pendulum validate our approach. We extend our approach to generate nonlinear torques at two joints by introducing the concept of torque decomposition. Experiments with a two-link robotic arm show that the gravitational forces from the masses on each link are accurately compensated for with our noncircular pulley-spring mechanisms.