Skip to content
0:00 / 0:00

#portableexecutable#win32#assembly

What is the Smallest Possible .EXE?

Inkbox

221K subscribers • 3 videos on Hallway

YouTube

Intermediate. Assumes working knowledge.

1M views2 years ago2 recommendations

Systems programmingOperating systemsPerformance and optimizationCompilers and interpreters

Inkbox explores the limits of the Portable Executable format to find the absolute smallest runnable EXE file on different versions of Windows.

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: github.com/InkboxSoftware/smallEXE/ About the PE file format: PE file format: learn.microsoft.com/en-us/windows/win32/debug/pe-format PE file diagram: github.com/corkami/pics/blob/master/binary/pe101/README.md Making Small EXE: Original research into smallest possible EXE: archive.is/w01DO World's Smallest Windows App (Dave's Garage): youtube.com/watch?v=-Vw-ONPfaFk Tiny PE on Windows 10 (x64): github.com/ayaka14732/TinyPE-on-Win10 More on the 268 byte limit: gist.github.com/kajott/063dfce6a94da03a379553b3db6be334 Refined MattKC snake: github.com/EimaMei/snake-qr Low Level Programming: Kernel32 functions: geoffchappell.com/studies/windows/win32/kernel32/api/index.h… Windows Virtual Terminal Sequences: learn.microsoft.com/en-us/windows/console/console-virtual-te… MSVC Linker options: learn.microsoft.com/en-us/cpp/build/reference/linker-options… What is the largest EXE: superuser.com/questions/667593/is-it-possible-to-run-a-large… This video is sponsored by Brilliant

Why it's here

2 people recommend this

What people say. Recommended for its interesting exploration of the Portable Executable format and binary size optimization.

u/AdreKisequein r/C_Programming • Recommends

On “What could be the smallest c binary possible”

Related video Doesn't quite match all the criteria of your post but you might find it interesting

u/moontoadzzzin r/compsci • Recommends

What is the Smallest Possible .EXE?

u/deftwarein r/C_Programming • Mentions

On “How do I create something like this in C”

It's a signed distance function fractal raymarcher. It could be rendering it and using Win32's GDI or DirectX API to output what the CPU generates to the screen, or it could be instantiating an OpenGL window and using a fragment shader to do all the work, but I don't see that fitting in 256b - though it would be way faster, though I guess interactive speeds aren't a priority when size is. There's a bunch of tricks people use to crunch down the size of an EXE as well, and after all that they usually run Crinkler on the result to pack it down even further. This is how you can make an EXE small: link to this video