Femtosecond laser-frequency comb techniques are vastly simplifying the measurement and synthesis of optical frequencies. A single mode-locked femtosecond laser, with its spectrum broadened by self-phase modulation in a microstructured or tapered nonlinear fiber, can produce millions of sharp laser lines in a precise evenly spaced grid spanning much of the visible and near-infrared spectrum. The absolute frequency of each line is determined by two observable radio-frequency signals. The pulse repetition rate gives the spacing of the comb lines and the rate at which the phase of the lightwave slips, relative to the intensity envelope from pulse to pulse determines the offset frequency by which each line is displaced from a precise integral multiple of the repetition frequency. This offset frequency can be measured most easily if the comb spans more than an optical octave so that one can observe a radio frequency beat note between the second harmonic of the infrared comb lines with the corresponding comb lines at the blue end. Such an optical-frequency synthesizer makes optical oscillations readily countable and provides the long-awaited compact optical clockwork for an all-optical clock.