PLATO is ESA's upcoming exoplanet-hunting mission. The spacecraft has 26 cameras equipped with a total of 104 individual CCDs, which together provide more than 2,000 megapixels, giving a combined optical sensitivity surface of 0.66m2. This is more than twice as much detector area than on ESA's Gaia mission, the largest camera ever flown in space. To measure changes in stellar brightness, the CCDs are read out at a cadence of 25 seconds, resulting in a massive amount of data that has to be processed on-board. In a pre-reduction step, hundreds of thousands of small windows of the target stars, called imagettes, are extracted from the detector arrays. This reduction process decreases the data volume down from several gigabytes to 25 MiB per acquisition period. Following this step, the remaining science data are sent to the instrument control unit (ICU), where they are processed and compressed in a lossless manner. While some science data products, such as measured backgrounds and fluxes, can be processed in software, the number of imagettes to be compressed (90% of the total science data) exceeds the available CPU resources. To solve this critical problem, a specialised hardware data compressor logic was developed for an RTAX-2000 field-programmable gate array (FPGA). The implemented compression method decorrelates the data temporally by a running average, which has an exponential tail. This pre-encoding step results in an almost geometric distribution of the residuals, a suitable input for the successive Golomb encoder. The set of parameters that control the encoder are semi- adaptive, i.e., they self-adjust to the data at certain intervals. While in principle being quite straightforward, the implementation turned out to be very challenging with the required handling of the data streams in real-time. With our approach we are able to meet the high requirements and managed to process the imagette data lossless with a speed of 2 MBps at a compression ratio up to 3.2. This paper shows how the PLATO data compression concept works, which algorithms are involved in it, and discusses the specifics of the hardware and software implementation.