MENU

Fun & Interesting

What is the Smallest Possible .EXE?

Inkbox 585,732 lượt xem 7 months ago
Video Not Working? Fix It Now

What is the smallest possible EXE that can be run on the Windows Operating System? What about the largest possible EXE? What even is an EXE file? On Windows, EXE files use the Portable Executable file format, which contains the program's code, data, and references to other libraries that can be loaded and run by the OS. It is often referred to as an "Image", the captured state of the program in a form ready to be run by the system.

After testing it was found that the smallest EXE on 64-bit Windows is 268 bytes. This is a system limitation and not a limit with the Portable Executable file format itself. The smallest EXE runnable by other versions of Windows are as follows:
Windows XP: 97 bytes
Windows 2000: 133 bytes
Windows Vista/7 (32-bit): 252 bytes
Windows 7/10/11 (64-bit): 268 bytes

The largest EXE possible is 1,996,488,704 bytes. Again, this size is a limitation with Windows.

GitHub project containing 268 byte EXE, world's smallest game, and world's smallest piano:
https://github.com/InkboxSoftware/smallEXE/

About the PE file format:
PE file format: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format
PE file diagram: https://github.com/corkami/pics/blob/master/binary/pe101/README.md

Making Small EXE:
Original research into smallest possible EXE: https://archive.is/w01DO
World's Smallest Windows App (Dave's Garage): https://www.youtube.com/watch?v=-Vw-ONPfaFk
Tiny PE on Windows 10 (x64): https://github.com/ayaka14732/TinyPE-on-Win10
More on the 268 byte limit: https://gist.github.com/kajott/063dfce6a94da03a379553b3db6be334
Refined MattKC snake: https://github.com/EimaMei/snake-qr

Low Level Programming:
Kernel32 functions: https://www.geoffchappell.com/studies/windows/win32/kernel32/api/index.htm
Windows Virtual Terminal Sequences: https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
MSVC Linker options: https://learn.microsoft.com/en-us/cpp/build/reference/linker-options?view=msvc-170&viewFallbackFrom=vs-2019

What is the largest EXE: https://superuser.com/questions/667593/is-it-possible-to-run-a-larger-than-4gb-exe

This video is sponsored by Brilliant

Comment