XCODX |

FreeBASIC Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About FreeBASIC

FreeBASIC is an open source compiler that keeps the spirit of 1990s QuickBASIC alive while producing real native executables for modern systems. It offers a QB-compatible dialect, so classic PRINT, INPUT, and GOSUB listings from old magazines and textbooks often compile unchanged, plus an extended mode with pointers, types, and inline assembly for serious work. The project has been maintained since 2004 and remains the go-to for retro game hobbyists, DOS-era code preservationists, and teachers who want the gentlest possible first syntax. Run your FreeBASIC program here in an interactive browser terminal: INPUT statements halt and wait for your typed answer exactly like the blinking-cursor days, with no compiler to install.

Hello World in FreeBASIC

Dim playerName As String
Dim guess As Integer
Dim secret As Integer

secret = 7

Input "Enter your name: ", playerName
Print "Welcome, "; playerName; "!"

Input "Guess a number between 1 and 10: ", guess

If guess = secret Then
    Print "Correct! You read my mind."
ElseIf guess < secret Then
    Print "Too low. The number was"; secret
Else
    Print "Too high. The number was"; secret
End If

For i As Integer = 1 To 3
    Print "Classic BASIC loop, pass"; i
Next i

When to use FreeBASIC

FreeBASIC is beloved in retrocomputing circles for porting QBasic games like Gorillas and Nibbles to modern machines, and in classrooms where an unintimidating PRINT/INPUT loop is the fastest route to a student's first working program. Hobbyists writing small 2D games use its built-in graphics keywords locally, while this console environment suits algorithm drills, text adventures, and homework from intro courses still structured around BASIC. It is also handy for verifying behavior of legacy listings found in archived programming books before adapting them to other languages.

Common questions

Does INPUT pause for real typing in the online terminal?

Yes. INPUT "prompt: ", variable displays your prompt in the live terminal and stops the program until you respond, matching the behavior every BASIC textbook describes. String and numeric variables both work, and multiple INPUT statements execute in sequence, so guessing games and menu-driven programs run exactly as written.

Will my old QBasic or QB64 code run here?

Much of it will. FreeBASIC's -lang qb dialect targets QuickBASIC compatibility, and console-only listings using PRINT, INPUT, IF, FOR, and DIM usually compile directly. Screen graphics, sound statements, and QB64-specific extensions are where differences appear, so text-mode programs are the safest candidates for a straight copy-paste.

Can I use graphics commands like SCREEN and PSET on this page?

No. The environment is a text terminal, so graphics modes, sprites, and drawing statements have no display to render to, and programs invoking them will not show visuals. Everything text-based works: console output, keyboard input, string functions, math, arrays, and user-defined types, which covers the classic learning path.

How FreeBASIC runs on XCODX

Sandbox filename
main.bas
Entry point
single main source file
Editor grammar
vb
Reading stdin
INPUT
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

' FreeBASIC Program
Print "Hello from FreeBASIC!"
Print "Welcome to XCODX Online Compiler!"

Dim As Integer i, total
total = 0
For i = 1 To 5
    total += i
Next
Print "Sum of 1 to 5 = "; total