About Turbo Pascal Online

A free Turbo Pascal 7 IDE that runs in your browser: the Borland-blue editor, an 80×25 text-mode console, and a real Pascal interpreter. Nothing to install, no account, no server round-trip -- your code is compiled and run by JavaScript on your own machine.

Open the IDE ›

What Turbo Pascal was

Borland released Turbo Pascal in 1983 for CP/M and DOS, written by Anders Hejlsberg. It cost $49.95 at a time when compilers routinely cost hundreds of dollars, and it was fast enough to compile a whole program between keystrokes -- editor, compiler, and runtime in a single program that fit comfortably on a floppy disk.

Version 7, released in 1992, is the one most people remember: the blue full-screen IDE, the gray menu bar across the top, the F-key hints along the bottom, F9 to compile and Ctrl+F9 to run. It was the machine that a generation of programmers learned on, and for many countries it stayed the standard teaching environment well into the 2000s. This site recreates that environment closely enough to be useful for the same purpose.

How it works

There is no DOSBox and no emulator here, and nothing is sent to a server to be compiled. The Pascal implementation is hand-written in TypeScript and runs entirely in your browser tab:

Your work is kept in browser local storage, so a reload doesn't lose it, and File › Share link... turns the current program into a link you can send to someone for 30 days.

What the interpreter supports

Graphics

InitGraph switches the screen out of text mode into 640×480 with 16 colors -- VGA/VGAHi, the mode nearly every Turbo Pascal graphics program asks for -- and CloseGraph switches back, exactly as the real thing did. It is emulated with a pixel framebuffer, so the drawing is genuine: PutPixel, Line, Rectangle, Bar, Bar3D, Circle, Arc, Ellipse, FillEllipse, PieSlice, DrawPoly, FillPoly, FloodFill, the twelve SetFillStyle patterns, SetLineStyle, XOR write mode, viewports, and OutText/OutTextXY. See CUBE3D.PAS for a worked example.

Compile errors and runtime errors carry a line and column, and the IDE jumps the cursor straight to the offending character the way the original did.

Not supported

This targets the textbook subset of Turbo Pascal, which covers most course exercises and retro-programming curiosity but not everything Borland shipped. Missing: object and OOP, file I/O, units other than the built-in Crt and Graph, pointers, sets, and inline assembly. Within Graph, the sprite calls (GetImage, PutImage, ImageSize) need pointers and GetMem, so they are absent, and the stroked BGI fonts fall back to the default 8×8 one. Real numbers print as trimmed fixed-point rather than Turbo Pascal's scientific notation, which reads better in a browser.

Keyboard shortcuts

F9 / Alt+F9Compile
Ctrl+F9Compile and run
Alt+F5Toggle the user screen (your program's output)
F2Save the current file to disk
F3Open a sample or a .pas file from your machine
F6 / Shift+F6Next / previous edit window
Alt+F3Close the active window
Alt+BkSpUndo
Shift+Del / Ctrl+Ins / Shift+InsCut / copy / paste
Alt+F10Editor local menu (right-click works too)
Alt+XExit

The menu bar is reachable with Alt plus the highlighted letter -- Alt+F for File, Alt+R for Run, and so on.

Where to start

The IDE opens on WELCOME.PAS; press Ctrl+F9 to run it. Press F3 for the rest, or read them here first on the sample programs page -- ten annotated programs from "Hello, World!" up to a rotating wireframe cube and a Mandelbrot renderer.

The whole thing is open source: github.com/mikla/tp-ide.