SSJX.CO.UK
Content

Making Go Exe Files Smaller

One of the surprising things about using Google Go is the size of the created exe files. In the previous guide, the basic Hello World program was around 2.5MB! The equivalent C program is usually < 50KB

The two main reasons for this are:

Building Smaller Exe Files

To make an exe file without the debug/meta information we build using the following command go build -ldflags="-s -w"

So, to make our previous Hello World program smaller, we navigate to that folder and run the build as follows:

C:\Hello World>go build -ldflags="-s -w"

C:\Hello World>

This brings the file size down to around 1.6MB, still big but better than it was. One thing to note is that a lot of this size is fixed, so as your program grows, the exe will not grow as rapidly.

Updated (05/08/2026)