Skip to content

FreeBASICModern Open Source BASIC

Inheriting classic QBASIC syntax, embracing modern programming features

FreeBASIC
20+
Years of Development
800+
Documentation Pages
32/64
Bit Native Compilation
3
Major Platforms
Supported Operating Systems
Windows
Linux
DOS

What is FreeBASIC?

FreeBASIC is a free and open-source BASIC compiler compatible with Microsoft QBASIC/QuickBASIC 4.5 syntax while introducing modern programming language features. It generates fast and efficient 32/64-bit native code for Windows, Linux, and DOS platforms.

🎯 Why Choose FreeBASIC?

FeatureDescription
🎓 Beginner FriendlyClean, intuitive syntax makes it excellent for learning programming
🕹️ Nostalgia CompatibleRuns classic QBASIC programs and games perfectly
🏗️ Modern CapabilitiesSupports classes, objects, inheritance, polymorphism
⚙️ Systems ProgrammingSupports pointers, memory manipulation, inline assembly
🎨 Graphics ProgrammingPowerful built-in 2D graphics library for easy game development
🌐 Network ProgrammingBuilt-in support for Socket, HTTP and networking features

Code Examples

🎯 Classic Hello World

vb
' Classic "Hello, World!" program
Print "Hello, World!"
Sleep

📁 File Operations

vb
' Simple file read/write
Dim f As Integer = FreeFile
Open "test.txt" For Output As #f
Print #f, "Hello FreeBASIC!"
Print #f, "Second line of data"
Close #f

' Read file contents
Open "test.txt" For Input As #f
Dim buf As String
While Not Eof(f)
    Line Input #f, buf
    Print buf
Wend
Close #f
Sleep

🧮 Arrays & Algorithms

vb
' Bubble sort example
Dim arr(1 To 10) As Integer
Dim i As Integer, j As Integer, temp As Integer

' Initialize array
For i = 1 To 10
    arr(i) = Int(Rnd * 100) + 1
Next i

Print "Before: ";
For i = 1 To 10: Print arr(i); " ";: Next i
Print

' Bubble sort
For i = 1 To 9
    For j = i + 1 To 10
        If arr(i) > arr(j) Then
            Swap arr(i), arr(j)
        End If
    Next j
Next i

Print "After:  ";
For i = 1 To 10: Print arr(i); " ";: Next i
Print
Sleep

🧵 Multithreading

vb
' Multithreading example
#include once "fbthread.bi"

sub mythread( byval p as any ptr )
	print "hey! woeoio"
    print "------------------------------------------------"
end sub

threaddetach( threadcreate( @mythread ) )
sleep 1

dim as long i,a
dim s as string
for i = 1 to 200
    a += i
    s += " + " & i
next
print s & " = " & a

🚀 Try It Online

Write and run FreeBASIC code directly in your browser without installation!

Open in New Window ↗


About This Documentation

This site provides complete FreeBASIC documentation in English, automatically synchronized and translated from the FreeBASIC Wiki:

  • 📚 Language Reference - Complete syntax, keywords, operators
  • 📦 Runtime Library - Standard functions, strings, file operations
  • 🎨 Graphics Programming - Complete FBGFX documentation
  • 🔧 Compiler - Command line options, build configuration
  • FAQ - Frequently asked questions and solutions

Current documentation coverage: 789/807 pages


Community Resources

Official Site freebasic.net | Forum forum | Wiki wiki | GitHub github | Libraries libraries


Disclaimer

FreeBASIC is an independent open-source project with no affiliation to Microsoft Corporation.

BASIC, QBASIC, QuickBASIC and related trademarks are registered trademarks of Microsoft Corporation.

This documentation is provided for educational purposes only.

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft