Sub-K (Server Under Barely a Kilobyte) is a Win32 static web server in 887 bytes. Features include requested file serving, index.htm default routing, basic MIME type support, and thread-per-client concurrent connections. Default port is 80.
Sub-K follows in the same tradition as DTE, HelloAssembly, and TRPad. It's not really descended from any of those, aside from the flat memory model. My inspiration for Sub-1KB works came directly from Dave Plummer's HelloAssembly which again, can be found here.
Sub-K compiles with MASM and Crinkler. The build for this presentation is set at 887 bytes exe using 11.7 MB of RAM at run time. These are configurable. The source code history also offers "stages". If, for example, you want a much smaller exe with less features, you can build version sbk_017 for a single connection, single page, no images, server in 657 bytes.
If that isn't small enough for you, try version sbk_014 which has hard-coded "hello" and comes in at 552 bytes. The exe size will grow/shrink byte-for-byte as you put in your custom text.
![]() The Sub-K default start page |
![]() The custom Apple II Example Page |
![]() The server running. There was no room left for messages. |
Concurrent sessions testing was done with Apple IIe, iPhone, Win 11, and Win Server 2019.
Download/clone, unzip, and double-click sbk.exe. If you prefer a non-crinkler build, take the one from the Alt Build folder. The web server is now running on port 80. Visit from a browser to localhost or to ipaddress from another machine. The fixed default page is index.htm. The Apple II sample page may be of interest. It's designed to look the same whether from Contiki or a modern browser, and will be part of a different release.
I just wanted to. It's fun.
No. Sub-K is a sizecoding experiment and tiny local/static web server. It is not meant to replace a hardened production server.
Yes. In build.bat change the value of HASHSIZE: to a lower number for a larger exe and lower RAM usage. For example, on the 887 byte version setting HASHSIZE:1 raises the exe size to 946 bytes and lowers RAM usage to 1.7 MB. Testing reveals that HASHSIZE:11 is about the limit. Any higher offers little or no byte savings and RAM usage can start getting bonkers.
Not at all. I've included build_no_crinkler.bat for compiling using only MASM. This makes the former 932 byte version 5.5 KB and reduces RAM usage to 0.5 MB, and also helps with A/V woes. I personally use Crinkler because I have interest in making usable Windows programs under 1 KB, that's all.
"Hoagie" "Italian" and "#10" were considered. Actually "hoagie" for a server name makes me laugh. I may go back to that one in the future.
Important: Programs using Crinkler can be flagged as a false positive by antivirus, including Windows Defender. You may need to make an antivirus exception folder to build this, or Windows may delete the EXE as soon as the build completes. Therefore, try this out AT YOUR OWN RISK - NO WARRANTIES / NO GUARANTEES. You can accomplish this with PowerShell.
MASM version used: Microsoft (R) Macro Assembler Version 14.44.35224.0
- MASM can vary depending on version. If you experience:
C:\masm32\include\winextra.inc(11052) : error A2026:constant expected
C:\masm32\include\winextra.inc(11053) : error A2026:constant expected
In masm32\include\winextra.inc change:
STD_ALERT struct<br>
alrt_timestamp dd ?<br>
alrt_eventname WCHAR [EVLEN + 1] dup(?)
alrt_servicename WCHAR [SNLEN + 1] dup(?)
STD_ALERT ends
to:
STD_ALERT struct<br>
alrt_timestamp dd ?<br>
alrt_eventname WCHAR (EVLEN + 1) dup(?)
alrt_servicename WCHAR (SNLEN + 1) dup(?)
STD_ALERT ends<br>
The brackets on lines 13,14 were changed to parens.
- Build.bat contains: /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\um\x86"
You may need to change to fit your system: /LIBPATH:"....\Windows Kits\10\Lib\(your version)\um\x86" - You need to have Crinkler installed in a directory that has been added to PATH.
Example: C:\utils\Crinkler.exe



