A collection of assembly programs crafted for extremely minimal executable size.
These binaries are unsafe as a consequence of extreme size optimization. They:
- Skip all error handling on syscalls—failures are silent with no indication
- Have no bounds checking or input validation—no protection against malformed input or buffer overflows
- Assume specific kernel and CPU behavior (register state, ELF loader specifics)—will crash or misbehave if assumptions don't hold
These are proof-of-concept explorations of manually written assembly. Do not use in production or any real-world context.
A regular hello world program in C compiles to ~14 kilobytes. This project explores how small we can make these binaries through assembly optimization—a fun challenge in understanding the costs of abstraction.
Size reductions are achieved through:
- Minimal structure - Skip C runtime startup, dynamic linking, and metadata sections (e.g.,
.dynamic,.got,.eh_frame,.note.*) - Direct syscalls - Calling the kernel directly instead of going through libc wrappers
- Minimal code - Only essential instructions, no loops or conditionals unless necessary
The ELF format requires ~84 bytes minimum (ELF header + program header). The rest is code and data.
Result: hello-world in 115 bytes total vs. 14 KB—a 122x reduction.
Each tiny binary must meet these constraints:
- Functional correctness - Must perform the program's intended function (e.g., exit code for
true, output foryes, file reading forcat). Side effects don't matter (e.g.,hello-worldexits with code 1, not 0) - Platform compatibility - Must run on 32-bit x86 Linux or x86-64 Linux with IA-32 support
- Valid ELF executable - Must be a valid ELF binary (not DOS COM, PE, or other formats requiring emulation)
- No external dependencies - Must be fully self-contained (no libc, no runtime libraries)
- Single executable file - Must be a single binary file with no external scripts or support files
- Direct syscalls only - Cannot use libc wrappers; must call syscalls directly
- Minimize size - Binary size is the primary optimization goal
- NASM
- GCC
- GNU make
| Program | Status | Bytes |
|---|---|---|
| hello-world | ✅ | 115 |
| true | ✅ | 87 |
| yes | ✅ | 102 |
| factorial | ⏳ | - |
| fibonacci | ⏳ | - |
| echo | ⏳ | - |
| date | ⏳ | - |
| simple HTTP "Hello" server | ⏳ | - |
| GNU Coreutils | ⏳ | - |
# clone the repo
git clone https://github.com/AlphaLynx0/tiny-bins.git
cd tiny-bins/hello-world
# assemble, compile, and compare both versions
make savingsEach subdirectory follows the same pattern:
makebuilds both the ASM and C versionsmake listingshows the assembly instruction breakdown with byte offsets and sizesmake savingscompares their sizesmake test(if implemented) tests the output of ASM and reference binariesmake cleandeletes binaries and listing files
MIT © AlphaLynx alphalynx@alphalynx.dev