.D

D File

D Programming Language Source File
Ask a question
QUICK ANSWER

A .d file is almost always a D programming language source file - plain UTF-8 text compiled into a native executable by DMD, GDC, or LDC. Open and edit it in VS Code with the code-d extension, or any text editor. Compilers such as GCC also generate .d files as GNU make dependency lists, which are unrelated to the D language.

Developer: Walter Bright (Digital Mars); now D Language Foundation Category: Developer Files Open standard MIME: text/x-dsrc
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jun 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 D file format?

.d files contain source code written in the D programming language, a systems-level language designed by Walter Bright at Digital Mars and first released in 2001. D combines C-like syntax with higher-level features including garbage collection, built-in unit testing, template metaprogramming, mixins, ranges, and Uniform Function Call Syntax (UFCS).

D source files are plain UTF-8 text. A typical .d file begins with an optional module declaration, followed by import statements, then declarations for functions, classes, structs, interfaces, or templates. D supports inline documentation comments using /// (line) or / */ (block) syntax. Three compilers target .d files: DMD (the reference compiler), GDC (GCC front-end), and LDC** (LLVM back-end), all implementing the current D2 specification maintained at dlang.org.

D1 (the original version) was deprecated around 2010 and is source-incompatible with D2, which has been the active standard since then. Interface files with the .di extension serve a role analogous to C headers, containing declarations without implementation bodies. Editors support .d files via plugins - for VS Code the code-d extension provides syntax highlighting, completion, and build integration.

Security & safety

RISK: LOW

Plain text source code - no executable content in the .d file itself; it must be compiled to run. Safe to open in any text editor. Untrusted D source code must be compiled and reviewed before execution.

Format details

in a nutshell
FULL NAMED Programming Language Source Fileaka D source file, dlang source
DEVELOPERWalter Bright (Digital Mars); now D Language Foundationsince 2001 (D 1.0 by Walter Bright / Digital Mars)
MIME TYPEtext/x-dsrc
TYPEPlain text source code (UTF-8)
STANDARDOpen · royalty-free
This extension is also used by…
  • Makefile dependency file - GNU make and compilers (gcc -MD) generate .d dependency files listing header dependencies; plain text, no relation to D language.
  • ChemDraw chemical output - Rarely, some ChemDraw export formats use .d; entirely unrelated to the D programming language.
  • Patch / diff fragment - Some diff/patch tools use .d for unified diff fragments on Unix systems.

Programs that open D files

Windows4 apps
Code::Blocks Open-source Install Code::Blocks with the D-language plugin; supports DMD compilation and basic editing.
VS Code with D extension (code-d) Open-source Install 'code-d' extension from VS Code Marketplace; provides syntax highlighting, autocomplete (serve-d LSP), and DUB build integration.
DMD (D compiler) Open-source dmd file.d compiles to native executable; dmd -run file.d to compile and run immediately.
Visual Studio + VisualD Open-source Install VisualD plugin for Visual Studio; provides D project support, debugging, and IntelliSense-like features.
macOS3 apps
TextMate Paid Open .d files for syntax-highlighted editing; no compilation support built-in.
VS Code with code-d extension Open-source Same as Windows - install code-d from VS Code Marketplace.
DMD (D compiler) Open-source Install via brew: brew install dmd or download from dlang.org; compile with dmd file.d.
Linux4 apps
Code::Blocks Open-source Available on Linux; configure with D compiler plugin.
GDC Open-source GCC-based D compiler included in GCC since version 9; gdc file.d. Note: website http://www.gdconf.com in db is WRONG (that is Game Developers Conference) - correct URL is gdcproject.org.
VS Code with code-d extension Open-source Install code-d from VS Code Marketplace; integrates serve-d LSP for full IDE features.
DMD (D compiler) Open-source Available via system packages (apt install dmd) or dlang.org; dmd file.d to compile.

Technical details

deep spec
Format typePlain text source code (UTF-8)
EncodingUTF-8; BOM optional; non-UTF-8 source triggers a compile error
MIME typetext/x-dsrc
Typical file size500 B - 200 KB per source module
Module declarationOptional `module name;` statement at top of file
CompilersDMD (reference/Digital Mars), GDC (GCC front-end), LDC (LLVM back-end)
Language versionsD1 (deprecated ~2010) and D2 (current); the two are source-incompatible
Unit testingBuilt-in `unittest` blocks embeddable directly in source files
Documentation comments`///` (line) and `/** */` (block) DDoc syntax, processed by DMD -D flag
Conditional compilation`version()` and `debug` blocks within source
PlatformWindows, Linux, macOS, FreeBSD
Related file.di (D interface file - declarations only, analogous to C headers)
Standard libraryPhobos (imported via `import std.*`)
Released2001 (D 1.0 by Walter Bright / Digital Mars)
Latest versionD 2.109.x (2026); D spec at dlang.org
Open standardYes · royalty-free
Specificationdlang.org

Community Q&A

asked by users
Ask a quick question
Get help from people who work with D 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 D files.

Frequently asked questions

What is a .d file?
Almost always a D programming language source file - plain UTF-8 text compiled by DMD, GDC, or LDC. Less commonly, .d files are GNU make dependency files generated by compilers (e.g., gcc -MD).
How do I compile a .d file?
Install DMD from dlang.org, then run: dmd file.d (produces a native executable). Use dmd -run file.d to compile and execute in one step. DUB (the D package manager) handles multi-file projects.
Why does the database say .d is a ChemDraw file?
That is incorrect - .d is overwhelmingly used for D programming language source files. ChemDraw occasionally uses .d for export but this is not the dominant meaning.
What editor is best for D files?
VS Code with the code-d extension (provides the serve-d language server for autocompletion and error highlighting) is the most popular choice. Visual Studio + VisualD is a full IDE option on Windows.
What is a .di file vs. a .d file?
.di is a D interface file - contains declarations without implementation, analogous to a C header (.h). The compiler looks for .di before .d when resolving imports.

References

1Wikipedia - D (programming language)en.wikipedia.org
2D Programming Language official sitedlang.org

Keep exploring

across the database

Top extensions this week

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

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