Hello, World
extends Node
func _ready() -> void:
print("Hello, World!")Tap Run to execute
main.gd · output appears here
Press Run to execute
Output streams here as your program runs.
GDScript is the scripting language of the Godot game engine: Python-like indentation, optional static types, signals and coroutines, all built around a tree of nodes. CompileBytes runs your script with a headless Godot 4.7.2 build on the server, so print() output appears in the console within a fraction of a second and nothing has to be installed. Write a script that extends Node and put your code in _ready(), or extend SceneTree and call quit() like a command-line Godot script; both forms run as they would inside the engine.
The playground is for the language itself: variables, functions, classes, arrays and dictionaries, signals, await on timers and tweens, Vector2 and Vector3 math, JSON and RegEx. There is no window, renderer or scene file, so it will not draw sprites or load .tscn scenes, but everything else in the GDScript reference is available. Add more .gd files from the file explorer and use preload("helper.gd") or a class_name to share code between them.
main.gd is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
main.gd preloads helper.gd and calls its static function.
extends Node
const Helper = preload("helper.gd")
func _ready() -> void:
print(Helper.answer())
static func answer() -> int:
return 42
extends Node
func _ready() -> void:
print("Hello, World!")extends Node
func _ready() -> void:
var name := "Godot"
var version: float = 4.7
const MAX_LIVES = 3
var scores := [10, 20, 30]
var total := 0
for s in scores:
total += s
print("%s %s has %d lives" % [name, version, MAX_LIVES])
print("total: ", total)
print(typeof(scores) == TYPE_ARRAY)extends Node
func grade(score: int) -> String:
if score >= 90:
return "A"
elif score >= 75:
return "B"
else:
return "C"
func _ready() -> void:
for s in [95, 80, 60]:
print(s, " -> ", grade(s))
var i := 0
while i < 3:
i += 1
print("i is ", i)extends Node
func describe(value) -> String:
match value:
0:
return "zero"
1, 2, 3:
return "small"
var n when n is int and n > 100:
return "big"
[var x, var y]:
return "pair of %s and %s" % [x, y]
_:
return "something else"
func _ready() -> void:
for v in [0, 2, 500, [1, 2], "hi"]:
print(describe(v))extends Node
func capitalized(n: String) -> String:
return n.capitalize()
func starts_with_a(n: String) -> bool:
return n.begins_with("a")
func _ready() -> void:
var inventory := { "sword": 1, "potion": 3 }
inventory["arrow"] = 20
for item in inventory:
print(item, ": ", inventory[item])
var names := ["zed", "amy", "bob"]
names.sort()
print(names)
print(names.map(capitalized))
print(names.filter(starts_with_a))extends Node
class Animal:
var name: String
func _init(animal_name: String) -> void:
name = animal_name
func speak() -> String:
return "..."
class Dog extends Animal:
func speak() -> String:
return name + " says woof"
func _ready() -> void:
var pets := [Dog.new("Rex"), Animal.new("Blob")]
for pet in pets:
print(pet.speak())extends Node
signal health_changed(new_value: int)
var health := 100
func take_damage(amount: int) -> void:
health -= amount
health_changed.emit(health)
func _on_health_changed(value: int) -> void:
print("health is now ", value)
func _ready() -> void:
health_changed.connect(_on_health_changed)
take_damage(30)
take_damage(50)extends Node
func _ready() -> void:
print("starting")
await get_tree().create_timer(0.5).timeout
print("half a second later")
var result = await slow_add(2, 3)
print("result: ", result)
func slow_add(a: int, b: int) -> int:
await get_tree().process_frame
return a + bextends Node
func _ready() -> void:
var a := Vector2(3, 4)
var b := Vector2(1, 0)
print("length: ", a.length())
print("normalized: ", a.normalized())
print("dot: ", a.dot(b))
print("lerp: ", lerp(0.0, 10.0, 0.25))
print("clamped: ", clamp(15, 0, 10))
print("degrees: ", rad_to_deg(PI / 2))extends Node
func _ready() -> void:
var line := OS.read_string_from_stdin(1024).strip_edges()
var n := int(line)
print("Doubled: ", n * 2)extends SceneTree
func _init() -> void:
print("Running without a scene")
for i in range(3):
print("tick ", i)
quit()The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand with Run or Ctrl/Cmd + Enter, or turn on Auto-run in the editor settings to execute after each typing pause
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
GDScript is one of 25 linked-project compilers. Run always starts main.gd; selecting a helper tab changes what you edit, not the entry file.
main.gd preloads helper.gd and calls its static function.
Linked-project languages (25): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Verilog, GDScript, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every GDScript tab and a README in one ZIP archive.