require 'zlib' str = """This is a bit of sample text. It's just trying really to be a pretty standard thing with some space layout and what have you. S'all good...""" zipped = Zlib::Deflate.deflate(str) # Don't print 'em, because the zipped will be binary and will # chew up your terminal. puts "Original: #{str.length} chars" puts "Zipped : #{zipped.length} chars" puts Zlib::Inflate.inflate(zipped)