Introduction
What is Free Pascal?
Free Pascal (FPC) is a mature, open-source compiler for Pascal and Object Pascal. It generates highly optimized, native machine code—just like C or C++—meaning your applications run incredibly fast without needing extra runtime environments or virtual machines.
Free Pascal runs on many operating systems and processor architectures, including Windows, Linux, macOS, FreeBSD, and a wide range of other platforms. The ecosystem includes powerful development tools and rich bundled libraries, It is highly compatible with Delphi and Turbo Pascal dialects.
FPC powers the popular Lazarus IDE and embraces a “write once, compile anywhere” philosophy. It allows developers to build everything from small command-line utilities and system scripts to massive cross-platform desktop applications, web servers, and embedded software.
Features
- Massive Cross-Platform Support - Write once, compile anywhere. FPC supports over a dozen architectures (x86, ARM, RISC-V) and operating systems (Windows, macOS, Linux, Android, iOS, WebAssembly). A full list of supported platforms can be found here
- Web & Node.js Ready - Free Pascal includes pas2js, an open-source transpiler that converts Object Pascal directly into JavaScript. This allows you to bring your strongly-typed code to the web, running seamlessly in any browser or Node.js environment.
- Deep Compatibility - Easily compile existing codebases with built-in compatibility modes for Turbo Pascal, Delphi, and Mac Pascal.
- Native Performance - Applications compile into fast, standalone executables with zero external dependencies.
- Modern Language Features - Write modern code using generics, operator overloading, properties, and custom attributes.
- Rich Standard Library - Includes a comprehensive Run-Time Library (RTL) for everything from basic string manipulation to networking and database connectivity.
- Commercial-Friendly License - FPC is free and open-source. A static linking exception (modified LGPL) allows you to build and distribute closed-source, commercial software without opening your own codebase.
What can you build with Free Pascal?
Cross-Platform Desktop Applications
This is one of Free Pascal’s biggest strengths. When combined with the Lazarus IDE (which provides a drag-and-drop visual interface similar to Delphi), you can build graphical user interface (GUI) applications rapidly.
- Supported OS: You can write your code once and compile native executables for Windows, macOS, Linux, and BSD.
- Types of software: Business and financial software, medical/scientific tools, multimedia players, and developer utilities.
Web Applications and Services
While not as mainstream as Node.js or Python for the web, Free Pascal is highly capable of web development.
- Backend: You can build robust, thread-safe server-side applications, REST APIs, and CGI scripts using frameworks like Brook Framework or fpWeb.
- Frontend (Transpiling): Free Pascal includes a tool called pas2js, which translates your Pascal code into JavaScript, allowing you to write client-side browser applications in Pascal.
Video Games and 3D Applications
Free Pascal is fast and provides low-level memory access, making it excellent for game development.
- Game Engines: You can use powerful Pascal-based engines like the Castle Game Engine (for complete 2D and 3D games) or ZenGL.
- Libraries: It has bindings for popular industry-standard libraries like SDL2, OpenGL, Vulkan, and Raylib (via Ray4Laz) to handle rendering, physics, and input.
Embedded Systems and IoT
Because Free Pascal can get “close to the metal” and compile directly for specific chips, it is great for hardware projects.
- You can write software for microcontrollers and boards like the Raspberry Pi, Arduino (AVR), and various ARM, Z80, or RISC-V based devices.
Mobile Applications
Free Pascal supports compiling for both Android and iOS. While setting up the toolchain can sometimes be more involved than using native tools like Android Studio or Xcode, it allows you to share your core business logic across your desktop and mobile apps.
Command-Line Tools and System Software
If you don’t need a graphical interface, you can build fast, lightweight, single-executable console applications. Because the binaries are completely self-contained (they do not require a virtual machine or heavy runtime environments like Java or .NET), they are perfect for system utilities, data processing scripts, or even writing entirely new custom Operating Systems.
Questions or Feedback?
Next
Dive right into the following section to get started: