Interactive Demo
This page demonstrates running TinyGo code compiled to WebAssembly in your browser. TinyGo produces incredibly small WASM binaries - 20x smaller than standard Go!
Loading TinyGo WASM module...
Output
Loading WebAssembly module (typically instant)...
Size Comparison
TinyGo: ~100KB (10%) Go: ~2MB (20%) Pyodide: ~10MB (100%)
How It Works
- Compile with TinyGo: Go code is compiled using
tinygo build -target wasm - Tiny WASM Binary: The browser loads only ~100KB of WASM
- Instant Execution: JavaScript calls Go functions via
js.Global() - Results Display: Go returns HTML strings rendered in the page
Why TinyGo?
- Ultra-compact: ~100KB vs ~2MB (standard Go) vs ~10MB (Pyodide)
- Instant startup: Near-zero loading time
- Native performance: Compiled code runs at near-native speed
- Mobile-friendly: Perfect for low-bandwidth scenarios
- GitHub Pages ready: Deploy static files anywhere
Perfect For
- Lightweight web applications
- Interactive documentation
- Fast-loading demos and prototypes
- Mobile-first experiences
- Edge computing scenarios
Limitations
- Not all Go stdlib packages are supported
- Some reflection features limited
- Smaller ecosystem than standard Go
- No goroutine scheduler (single-threaded)
TinyGo Source Code
The TinyGo code running in your browser:
Loading...
Installation
macOS:
brew install tinygo
Linux:
wget https://github.com/tinygo-org/tinygo/releases/download/v0.30.0/tinygo_0.30.0_amd64.deb sudo dpkg -i tinygo_0.30.0_amd64.deb
Or use Docker:
docker run --rm -v $(pwd):/src tinygo/tinygo:latest tinygo build -o main.wasm -target wasm /src/main.go