You can use QByteArray::qCompress ( const QByteArray & data, int compressionLevel = -1 ) and QByteArray::qUncompress ( const QByteArray & data )