.P

P File

Pascal Source Code File
Ask a question
QUICK ANSWER

A .p file is Pascal source code - a plain-text program in the Pascal language that a compiler turns into a runnable executable. Open it in any text editor or in Lazarus IDE; to run it, compile it with Free Pascal (fpc file.p). The same extension is also used by Progress OpenEdge business software for unrelated procedure files.

Developer: Pascal language (Niklaus Wirth); compilers: Free Pascal, GNU Pascal, Borland/Turbo Pascal Category: Developer Files Open standard MIME: text/x-pascal
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jul 25, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the P file format?

A .p file is a Pascal source code file - plain human-readable text written in the Pascal programming language. The extension was used by early Unix Pascal compilers, most notably Berkeley Pascal (pc), and by classic Macintosh Pascal environments, where .p was the default extension for program sources.

Inside the file you will find standard Pascal constructs: a program or unit header, a uses clause listing library dependencies, const, type, and var declaration blocks, and one or more procedure or function definitions, all ending with a begin...end. main block. Comments use curly-brace { } or parenthesis-star (* *) delimiters.

Today, .p files are compiled primarily with Free Pascal (fpc) or its Lazarus IDE, though legacy code may target GNU Pascal (gpc). Any plain-text editor opens .p files for reading and editing; Visual Studio Code with a Pascal extension provides syntax highlighting and basic language support.

.p is one of several Pascal source extensions. The dominant modern choice is .pas; Free Pascal also uses .pp; Delphi project files use .dpr. Compiled output typically produces an .o object file as an intermediate step before linking. Note that .p is also used by Progress OpenEdge ABL for procedure files, so the surrounding toolchain should be checked when the format is ambiguous.

  • Pascal dialects handled: Standard/ISO Pascal, Turbo/Borland Pascal, Object Pascal, Free Pascal
  • Compiled with fpc on all major platforms or legacy gpc on Unix/Linux
  • No binary content - pure ASCII or UTF-8 plain text throughout

Security & safety

RISK: LOW

A .p Pascal source file is plain text and does nothing until you COMPILE and run it - so simply opening one to read is safe. The risk is the same as any source code: it could contain malicious logic, so review code from untrusted sources before compiling/executing the resulting program. Be sure you've correctly identified the file as Pascal (vs a Progress 4GL .p) before trying to build it.

Format details

in a nutshell
FULL NAMEPascal Source Code Fileaka Pascal program file, Pascal source
DEVELOPERPascal language (Niklaus Wirth); compilers: Free Pascal, GNU Pascal, Borland/Turbo Pascalsince 1970 (Pascal language; .p used by various Unix/Mac Pascal compilers)
MIME TYPEtext/x-pascal
TYPEPlain-text programming-language source code
STANDARDOpen · royalty-free
This extension is also used by…
  • Progress OpenEdge ABL (4GL) procedure - Progress/OpenEdge business-application source ('.p' procedure files), edited/run in the OpenEdge AppBuilder/PDS - unrelated to Pascal.
  • GNU gettext / Perl source (rare) - Occasionally seen for Perl scripts or other source; context-dependent and uncommon.

Programs that open P files

Windows3 apps
Free Pascal / Lazarus Open-source Open the .p in Lazarus or compile with 'fpc file.p'. The leading free Pascal toolchain (Free Pascal compiler + Lazarus IDE).
Visual Studio Code Free Open as text with a Pascal extension for highlighting; build via the Free Pascal compiler in a task.
Notepad / any text editor Free Open the .p as plain text to read or edit the Pascal source (no compilation).
macOS2 apps
Free Pascal / Lazarus Open-source Compile with 'fpc file.p' or edit in Lazarus. The maintained cross-platform Pascal toolchain (replaces the dead Think/GNU Pascal).
TextMate / VS Code Free Open the .p as text for editing; build with the Free Pascal compiler.
Linux2 apps
Free Pascal / Lazarus Open-source 'fpc file.p' to compile, or edit in Lazarus. Available in most distro repositories.
GNU Pascal (gpc) - legacy Open-source Historic GNU Pascal compiler ('gpc file.p'); largely unmaintained - prefer Free Pascal today.

Technical details

deep spec
MIME typetext/x-pascal
EncodingASCII or UTF-8 plain text; no BOM required
File structurePascal program/unit header → uses clause → const/type/var declarations → procedures/functions → begin…end. main block
Comment syntaxCurly-brace { } or parenthesis-star (* *) delimiters; single-line // supported in Free Pascal and Delphi mode
File identificationNo magic bytes - identified by Pascal keywords such as program, unit, begin, end, var, procedure, function
Typical file sizeA few hundred bytes to tens of KB per source module
Supported Pascal dialectsStandard/ISO Pascal, Turbo/Borland Pascal, Object Pascal, Free Pascal 3.2.x
Primary compilerFree Pascal (fpc); historically Berkeley Pascal (pc) on Unix, GNU Pascal (gpc) on Linux
Compilation outputIntermediate .o object file linked into a native binary executable
Platform supportCross-platform source - Windows, macOS, Linux, Unix
Historical originExtension adopted by Berkeley Pascal on Unix and classic Macintosh Pascal; .pas later became the mainstream Pascal extension
Related source extensions.pas (dominant), .pp (Free Pascal), .dpr (Delphi project), .lpr (Lazarus project)
IDE supportLazarus IDE (Free Pascal's GUI front-end) recognizes and compiles .p alongside .pas sources
Syntax paradigmAlgol-derived structured programming; begin…end pairs delimit all compound statements and the program body
Ambiguity note.p is also used by Progress OpenEdge ABL for 4GL procedure files - the file's opening keyword (program/unit vs ABL-specific syntax) distinguishes the two
Released1970 (Pascal language; .p used by various Unix/Mac Pascal compilers)
Latest versionN/A (source text; tracks the Pascal dialect/compiler, e.g. Free Pascal 3.2.x / Object Pascal)
Open standardYes · royalty-free
Specificationwww.freepascal.org

P conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with P files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about P files.

Frequently asked questions

What is a .p file?
Most often Pascal source code - a plain-text program in the Pascal language that a compiler (Free Pascal, GNU Pascal) turns into an executable. The same extension is also used by Progress 4GL business apps.
How do I open a .p file?
Open it in any text editor or a Pascal IDE like Lazarus (with Free Pascal) to read/edit. To run it, compile with 'fpc file.p'. On modern systems use Free Pascal/Lazarus rather than the old Think/GNU Pascal.
How do I compile and run a .p Pascal program?
Install Free Pascal, then run 'fpc file.p' to build a native executable, and run that executable. Lazarus gives you a full IDE with build-and-run buttons.
What's the difference between .p and .pas?
Both are Pascal source text. .pas is the standard, widely recognized extension; .p is an older/less common one (Unix/Mac Pascal compilers). You can usually just rename .p to .pas.
Is my .p file Pascal or Progress 4GL?
Check the contents: Pascal uses program/unit, begin..end, procedure/function; Progress OpenEdge ABL uses statements like DEFINE VARIABLE, FOR EACH, DISPLAY. The right tool depends on which it is.
Can I turn a .p into an .exe?
You compile it, not convert it: 'fpc file.p' produces a native executable. There's no document-style conversion - Pascal source must be built by a compiler.

References

1Free Pascal - documentationwww.freepascal.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.JPGJPEG Image
4.PARTPartial Download File
5.MDMarkdown Document
6.BINCD/DVD Disc Image (BIN/CUE)
7.DATProgram Data File (generic)
8.RPMSGRestricted Permission Message
9.EXEWindows Executable (Portable Executable)
10.M4AMPEG-4 Audio File

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z