tinygo-org /tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.

★ 17,915⑂ 1,110👁 183⑃ 4,242● 2,004▤ 54
GoNOASSERTIONCreated 2018-06-07tinygo.org
Download: 0.44.00.44.0 ↓0.44.02026-10-28
+1
Daily
17,915
stars
1,110
forks
183
watchers
4,242
prs
2,004
issues
54
releases

README

TinyGo - Go compiler for small places

    

TinyGo is a Go compiler intended for use in small places such as microcontrollers, WebAssembly (wasm/wasi), and command-line tools.

It reuses libraries used by the Go language tools alongside LLVM to provide an alternative way to compile programs written in the Go programming language.

 [!IMPORTANT]
 You can help TinyGo with a financial contribution using OpenCollective. Please see https://opencollective.com/tinygo for more information. Thank you!

 Embedded

Here is an example program that blinks the built-in LED when run directly on any supported board with onboard LED:

go
package main

import (
    "machine"
    "time"
)

func main() {
    led := machine.LED
    led.Configure(machine.PinConfig{Mode: machine.PinOutput})
    for {
        led.Low()
        time.Sleep(time.Millisecond  1000)

        led.High()
        time.Sleep(time.Millisecond  1000)
    }
}


The above program can be compiled and run without modification on an Arduino Uno, an Adafruit Circuit Playground Express, a Seeed Studio XIAO-ESP32S3 or any of the many supported boards that have a built-in LED, just by setting the correct TinyGo compiler target. For example, this compiles and flashes an Arduino Uno:

shell
tinygo flash -target arduino-uno examples/blinky1


 WebAssembly

TinyGo is very useful for compiling programs both for use in browsers (WASM) as well as for use on servers and other edge devices (WASI).

TinyGo programs can run in Fastly Compute, Fermyon Spin, wazero and many other WebAssembly runtimes.

Here is a small TinyGo program for use by a WASI host application:

go
package main

//go:wasmexport add
func add(x, y uint32) uint32 {
	return x + y
}


This compiles the above TinyGo program for use on any WASI Preview 1 runtime:

shell
tinygo build -buildmode=c-shared -o add.wasm -target=wasip1 add.go


You can also use the same syntax as Go 1.24+:

shell
GOOS=wasip1 GOARCH=wasm tinygo build -buildmode=c-shared -o add.wasm add.go


 Installation

See the getting started instructions for information on how to install TinyGo, as well as how to run the TinyGo compiler using our Docker container.

 Supported targets

 Embedded

You can compile TinyGo programs for over 150 different microcontroller boards.
Firmware output extensions depend on the target. For example, RP2040 and
RP2350 targets support .elf, .hex, and .uf2 firmware outputs.

For more information, please see https://tinygo.org/docs/reference/microcontrollers/

 WebAssembly

TinyGo programs can be compiled for both WASM and WASI targets.

For more information, see https://tinygo.org/docs/guides/webassembly/

 Operating Systems

You can also compile programs for Linux, macOS, and Windows targets.

For more information:

- Linux https://tinygo.org/docs/guides/linux/

- macOS https://tinygo.org/docs/guides/macos/

- Windows https://tinygo.org/docs/guides/windows/

 Currently supported features:

For a description of currently supported Go language features, plea

Top issues

Discussions

Latest release

0.44.0 v0.44.0 2026-10-28
Mere weeks after our previous release, this new version brings massive performance boosts, improvements in toolchain support, and lots of new hardware. TinyGo now builds against LLVM 23 and drops support for LLVM versions below 15. The interp package now runs more of your program's initialization at compile time so startup is smaller and faster. The compiler skips slice bounds checks that cannot fail and avoids more byte slice copies in string comparisons. On the hardware side, the cores scheduler now supports the ESP32-S3 and adds core affinity for both it and the RP2040/RP2350. The ESP32-S3 

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON