About this Go playground
This is a Go compiler you can use straight away. Write Go in the editor, press Run, and your program is built with the Go toolchain and run. The output appears next to it: everything it prints, any compiler error with its line number, the exit code, and how long it took.
Your code is built and run in an isolated sandbox on our servers, with the real Go toolchain on Linux, so goroutines, channels and the whole standard library behave as they do on your own machine. It is free, with nothing to install and no account needed.
What you can run
- Go 1.27, running one file per run, saved as
main.go. - Compiled, then run. Each run compiles your file with
go build -o main main.goand runs the program if it compiles. Compiler errors and warnings appear in the output like any other error. - Standard library only. The whole Go standard library is there: fmt, strings, strconv, sort, slices, maps, math, time, encoding/json, sync, errors and the rest, already compiled so builds stay quick. There is no package installer, and programs have no network access.
- Limits: 10 seconds and 256 MB of memory per run, plus up to 20 seconds to compile first. Output past 64 KB is cut off, code can be up to 64 KB and input up to 16 KB.
- Fair use: 5 runs a minute and 50 a day without an account, 10 a minute when you are signed in.
Reading input
Open the Input box under the editor and type what your program should read. It arrives as standard input, os.Stdin: a bufio.Scanner reads it a line at a time, and fmt.Scan a word or number at a time. With the box empty, Scan returns false.
input := bufio.NewScanner(os.Stdin)
for input.Scan() {
fmt.Println(input.Text())
}Frequently asked questions
Is this online Go compiler free?
Yes. There is no sign-up and no limit on how much you can write. Signed-out visitors get a quick, usually invisible bot check when they press Run, and a fair-use cap of 5 runs a minute and 50 a day. Signing in raises it to 10 runs a minute.
Which version of Go does it run?
Go 1.27 on Linux, built with go build. Generics, range over integers and functions, and everything else in Go 1.27 and earlier works as it does on your computer.
Can I import packages from GitHub or use go.mod?
No. The playground builds one file, main.go, in package main, against the standard library only. There is no go get and no network, so imports such as github.com/... fail to build. Everything under the standard library's own import paths works.
Why does Go refuse to build my program over an unused variable?
Go treats an unused variable or an unused import as a compile error, not a warning, so the program does not run until you remove it or use it. Assigning to the blank identifier, as in _ = x, keeps a variable you need later.
Why did my program stop with a time-out?
Compiling gets up to 20 seconds of its own. Then the program gets 10 seconds and 256 MB of memory, and is stopped if it goes past either. The usual cause is a loop that never ends, a goroutine waiting on a channel that nothing sends to, or a read waiting for input that is not in the Input box.
Is my code saved or shared?
Your code is kept in your own browser so it is still there next time, and nowhere else. When you press Run it is sent to our code runner, run once in a sandbox, and thrown away. We do not store it or show it to anyone.