Visit my *NEW* blog taran's den v2

Wednesday, September 12, 2007

Compress any file to ZERO bytes..!

The BARF* compressor will compress any nonempty file by at least one byte. Thus, by compressing already compressed files over and over again, it is possible to eventually reduce any file to ZERO bytes.

You must be thinking that can also be done with Winrar or Winzip by compressing files over and over again. Is it? Wait, read the first line again, "The BARF compressor will compress any nonempty file by at least one byte." Winrar or Winzip can't do this!

BARF has been tested on the Calgary corpus, a well known benchmark. In just one pass, it achieves the best known result of any compressor, compressing all 14 files to 1 byte each. Run time is under 1 second on a 750 MHz PC. Of course these files can be compressed again down to 0 bytes each, just like any other file. (Yes, they can be decompressed correctly).
BARF is free, open source software, released under the GNU GPL.

Download BARF! (Windows executable, about 1 MB).
Source code:barf.cpp (includes compilation insructions)mkstring.cpp

Read more about BARF @

*Better Archiver with Recursive Functionality (BARF)


Gurpreet said...

hey, dis was supposed to be the next post on my blog... jst got d link ystrdy n trying to find some time to try it before posting... anywayz, kabhi toh try karoonga... for now, there's something else on my blog 'Tutorials for Mobile Phone R&D', do check tht out...

btw, did u try it out... including d decompression part... n did it worked???

taranjs said...

k cool.. yep i did try it out.. and it was proved that it compressed ne file by at least 1 Byte.. and its also not very slow like KGB.. wat d problem now is dat it has to be done manually ..

see wat i did..
1. i took a new notepad file
2. wrote "stinsy" in it
3. saved it, its size was 10 bytes
4. i compressed it 10 times over and over again.. AMAZINGLY it was showing zero bytes..
5. i then decompressed it again 10 times.. and opened it.. stinsy was written as it is in d text file..

obviously, its not for practical use in this form.. but if some script can be made.. it wud be awesome.. coz d algorithm is really grt..

n ya wil chek out ur blog soon..

Nikhil Sheth said...

Hi! I was surfing orkut's community and came across your poll ( I was amazed at the possibilities that this 1-byte compression can have, and downloaded barf and got started right away. 5 minutes on I realized the secret.. I'm sorry to dissapoint you, mate, but it's a TRICK! Like any magic trick, the missing bytes have been stored somewhere else discretely.
If u want the explanation then see it on my blog at

Nikhil Sheth said...

yup, other ppl also tried it out.. seems it was a joke done by the mahoney guy! check this page out

taranjs said...

oh dats grt nikhil for discovering this.. and ya i dint feel bad abt it... rather wanna thank u for knowledge sharing.. n being kind enuf for lettin me kno abt it.. evn i hd found this out dat this isnt possible as per laws of physics.. bt ya its indeed a magic trick which is grt.. n u kno.. i was thinkin abt writing a script for it so dat v dont hv to manually compress again n again. thanks dude u saved me.. lollz..
tc.. god bles ya..