What is the Smallest Possible .EXE?

Published: 27 June 2024
on channel: Inkbox
405,292
17k

To try everything Brilliant has to offer—free—for a full 30 days, visit https://brilliant.org/Inkbox/ . You’ll also get 20% off an annual premium subscription.

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/sma...

About the PE file format:
PE file format: https://learn.microsoft.com/en-us/win...
PE file diagram: https://github.com/corkami/pics/blob/...

Making Small EXE:
Original research into smallest possible EXE: https://archive.is/w01DO
World's Smallest Windows App (Dave's Garage):    • C vs ASM: Making the World's SMALLEST...  
Tiny PE on Windows 10 (x64): https://github.com/ayaka14732/TinyPE-...
More on the 268 byte limit: https://gist.github.com/kajott/063dfc...
Refined MattKC snake: https://github.com/EimaMei/snake-qr

Low Level Programming:
Kernel32 functions: https://www.geoffchappell.com/studies...
Windows Virtual Terminal Sequences: https://learn.microsoft.com/en-us/win...
MSVC Linker options: https://learn.microsoft.com/en-us/cpp...

What is the largest EXE: https://superuser.com/questions/66759...

This video is sponsored by Brilliant


Watch video What is the Smallest Possible .EXE? online without registration, duration hours minute second in high quality. This video was added by user Inkbox 27 June 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 405,292 once and liked it 17 thousand people.