BASIC Online: FreeBASIC Editor and Compiler

Write BASIC programs in the browser and run them with no compiler to install. Send a link, and two people can work on a problem together: in an interview, or walking through a solution side by side. Free, no sign-up.

Open the BASIC editor
Free, no sign-upHow to run a live coding interview in BASICCollaborative code editors compared

Code sample

DIM n AS INTEGER, i AS INTEGER, j AS INTEGER
DIM isPrime AS INTEGER
DIM primes AS STRING

n = 30
FOR i = 2 TO n
  isPrime = -1
  FOR j = 2 TO i \ 2
    IF i MOD j = 0 THEN isPrime = 0
  NEXT j
  IF isPrime THEN primes = primes + LTRIM$(STR$(i)) + " "
NEXT i
PRINT RTRIM$(primes)

Output

2 3 5 7 11 13 17 19 23 29

What the editor does

  • The FreeBASIC 1.9 compiler in QBasic compatibility mode: the program compiles and runs on the server, with compile errors and output visible right away.
  • Familiar QBasic syntax: variables without declarations, DIM … AS INTEGER, FOR … NEXT, IF … THEN, and the STR$, MID$ and LEN functions.
  • Nothing to install: the editor works in the browser on any computer.
  • Real-time collaborative editing: up to 5 participants in one session, with edits and cursors visible instantly.
  • The problem statement is written in Markdown right in the session, next to the code.
  • The task bank is open without an account. After a free sign-in: your own tasks, an interview mode with timers, and session history.

How to run the interview

  1. Click "Run an interview" — the session is created with a sample program.
  2. Describe the task in Markdown and send the link: the other participant needs no sign-up.
  3. Work on the problem together: run the program after each step, and discuss compile errors and output — a convenient way to walk through a solution piece by piece.

Typical interview tasks

  • Find all primes up to N by trial division, and work out how far the divisors need to go.
  • Compute the GCD of two numbers with Euclid's algorithm in a WHILE … WEND loop.
  • Find the sum and the digit count of a natural number using MOD and integer division \.
  • Sort an array with bubble sort and print it after every pass.
  • Check whether a string is a palindrome by walking its characters with MID$.
  • Print a multiplication table with aligned columns.

Limitations

  • This is FreeBASIC in QBasic mode (-lang qb): syntax that exists only in FreeBASIC, such as Dim As Integer a = 3, will not compile.
  • PRINT puts a space before a positive number (room for the sign), as QBasic does. To print a number without it, use LTRIM$(STR$(x)).
  • There are no autotests for BASIC — verify the result with output: print the answer for several inputs and compare it with what is expected.
  • Compilation is limited to 10 seconds, and a run to 3 seconds and 64 KB of output.

FAQ

Which compiler is used?
FreeBASIC 1.9 in QBasic compatibility mode. The program compiles and runs on the server, so there is nothing to install.
Will a QBasic or QuickBASIC program run?
Usually, yes: QBasic mode understands variables without declarations, type suffixes such as $ and %, SUB and FUNCTION.
Can I enter keyboard input (INPUT)?
Yes. Type the data into the «Input (stdin)» field above the output — on Run, INPUT and LINE INPUT read it as if it were typed. The field is shared by everyone in the session.
Can two people work together?
Yes. Send the session link — up to 5 participants can work in one editor, with edits visible in real time.
Do I need to sign up?
No. Create a session and start writing code right away. The task bank is open without an account too. Signing in is needed for your own tasks and history: without it the session is not saved, but the code can be copied.

Editors for other languages