Hello, World!
program Hello;
begin
writeln('Hello, World!');
end.Tap Run to execute
main.pas · output appears here
Press Run to execute
Output streams here as your program runs.
Pascal is an imperative, procedural programming language designed by Niklaus Wirth around 1970, named after mathematician Blaise Pascal. It was created to encourage good programming practices using structured programming and strong static typing, and for decades it was a popular teaching language. Pascal emphasizes readability with explicit begin/end blocks, clear type declarations, and a strict compiler that catches many mistakes before a program ever runs.
On CompileBytes, Pascal programs are built with Free Pascal (FPC) version 3.2.2, an open-source, cross-platform compiler that supports the classic Pascal standard along with Object Pascal and Delphi-compatible extensions. It is widely used in education, competitive programming, and legacy maintenance, and ships with a large runtime library. Free Pascal compiles to fast native code, making it suitable for both small learning exercises and larger applications.
main.pas is the entry point for each run.
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.
program Hello;
begin
writeln('Hello, World!');
end.program Squares;
function Square(n: Integer): Integer;
begin
Square := n * n;
end;
begin
writeln('Square of 5 is ', Square(5));
end.program Counting;
var
i: Integer;
begin
for i := 1 to 5 do
writeln('Count: ', i);
end.program Greet;
var
name: string;
begin
write('Enter your name: ');
readln(name);
writeln('Hello, ', name, '!');
end.program Fact;
function Factorial(n: Integer): Integer;
begin
if n <= 1 then
Factorial := 1
else
Factorial := n * Factorial(n - 1);
end;
begin
writeln(Factorial(6));
end.program SumArray;
var
nums: array[1..5] of Integer = (1, 2, 3, 4, 5);
i, total: Integer;
begin
total := 0;
for i := 1 to 5 do
total := total + nums[i];
writeln('Sum: ', total);
end.program People;
type
Person = record
Name: string;
Age: Integer;
end;
var
p: Person;
begin
p.Name := 'Ada';
p.Age := 36;
writeln(p.Name, ' is ', p.Age);
end.program Countdown;
var
n: Integer;
begin
n := 5;
while n > 0 do
begin
writeln(n);
n := n - 1;
end;
end.program Grade;
var
score: Integer;
begin
score := 2;
case score of
1: writeln('one');
2: writeln('two');
3: writeln('three');
else
writeln('other');
end;
end.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, or turn on Auto-run to execute on every change
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
Pascal is one of 46 single-file compiler scratchpads. Each run submits only main.pas; local sibling-file imports are not enabled.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, 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.
Download file exports the active Pascal source file.