A self-extracting archive (SFX) is a computer application which contains a file archive, as well as programming to extract this information. Such file archives do not require a second executable file or program to extract from the archive, as archive files usually require. The files in an archive can thus be extracted by anyone, whether they possess the appropriate decompression program or not, as long as the program can run on their computer platform.
The original purpose for the self-extracting archive was to allow the distribution of tools for extracting (and adding) member files to an archive file. The situation otherwise, in effect, represents a "chicken and egg" problem: in order to use an archive file, the user requires a de-archiver program, which they have to be able to get onto their computer. If the de-archiver program was simply a single executable with no other files, it would be possible to simply download that one file, then execute it. But if the means to unarchive files required, say, an executable program and several libraries, there would be no way to obtain them as a single download or executable which could be installed unless the unarchiver program itself (along with accompanying files) were a self-extracting archive.
Several programs can create self-extracting archives. For Windows there are WinZip, WinRAR, 7-Zip, WinUHA, KGB Archiver, the built-in IExpress wizard and many other experimental ones. For Macintosh there are StuffIt, The Unarchiver, and 7zX. There are also programs that create self-extracting archives on Unix as shell scripts which utilizes programs like tar and gzip (which must be present in destination system). Others (like 7-Zip or RAR) can create self-extracting archives as regular executables in ELF format. An early example of a self-extracting archive was the Unix shar archive, in which one or more text files were combined into a shell script that when executed recreated the original files.
The main downside of self-extracting archives is that running executables downloaded from the Internet may pose a security risk. With a regular archive, one could open it with an unarchiver without running any foreign code. However, with an executable, it is not possible to clearly verify whether an archive contains a malicious program.
Another issue with self-extracting archives is that they are platform-specific. For example, a self-extracting archive for Windows will not run on Mac OS X.
Self-extracting archives also include additional code in order to properly run and to display any user messages for the installation. While this amount of extra data is usually small, it could defeat the purpose of compressing lossy file types, such as a group of .jpeg images. The small amount of data that would have been saved by compressing the .jpeg files would be cancelled out by the addition of extra programming code in order for the executable file to self-extract properly.