We introduce a noninterferometric single beam method to characterize and compensate the spectral phase of ultrashort femtosecond pulses accurately. The method uses a pulse shaper that scans calibrated phase functions to determine the unknown spectral phase of a pulse. The pulse shaper can then be used to synthesize arbitrary phase femtosecond pulses or it can introduce a compensating spectral phase to obtain transform-limited pulses. This method is ideally suited for the generation of tailored spectral phase functions required for coherent control experiments.