A highly flexible optical packet compressor is presented. The compressor is capable of providing various compression ratios using the same hardware. It is composed of three parts: a chirped packet generator, a signal compressor, and a wavelength converter. In the chirped packet generator, the modulator intensity-modulates a series of supercontinuum chirped optical carriers and generates a series of chirped optical packets. The signal compressor compresses the chirped packets. The wavelength converter then transforms the compressed wideband optical packets into single-wavelength signals. We numerically demonstrate that using dispersive devices (chirped Bragg grating array or dispersion compensation fiber), we can compress both the width of pulses and the distance among pulses at the same time. This results in an increase of the bit rate. We also show that during the compression, the optical packet suffers distortion in the time domain, which can be defined as an extinction ratio. The distortion can be minimized by control parameters such as carrier chirping and modulating bandwidth. We present a highly flexible optical packet compressor, which is capable of compressing hundreds of bits packets from low speed (mega- or gigabits per second) to very high speed (up to 40 Gbits/s).