What is a .d file?
D Source File · Code and data · Walter Bright / D Language Foundation · 2001
A .d file is D source code, a compiled systems language designed as a cleaner successor to C++. It combines native speed with garbage collection, modules and strong metaprogramming.
What is a .d file used for?
D was created by Walter Bright, author of the first native C++ compiler, to keep C++'s power while shedding its historical baggage: it adds modules, ranges, contracts and compile-time function execution.
One naming trap: build tools like Make also produce .d dependency files, which are small text lists, not D programs. A real D source file contains code with import statements and C-style braces.
What opens a .d file?
The .d format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- VS Code (code-d)
- any text editor
macOS
- VS Code (code-d)
- any text editor
Linux
- VS Code (code-d)
- any text editor
Open a .d file step by step
- Confirm the file really is a .d. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with VS Code (code-d) or any text editor.
- On Mac, use VS Code (code-d) or any text editor.
- On Linux, try VS Code (code-d) or any text editor.
- Still stuck? Convert the .d to exe (compiled), which opens more widely.
Why can't I open my .d file?
Almost always because no installed app understands D. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .d at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
How to convert a .d file
You can convert a .d file to exe (compiled) using a conversion tool or the export menu of an app that opens it.
D has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.
Frequently asked questions
What is a .d file?
A .d file is D source code, a compiled systems language designed as a cleaner successor to C++. It combines native speed with garbage collection, modules and strong metaprogramming.
How do I run a .d file?
Install a D compiler (dmd, ldc or gdc) and run dmd -run file.d, or manage a project with dub, D's package and build tool.
Is every .d file a D program?
No. Compilers and Make generate .d dependency files, which are plain lists of file paths. If the content is code with imports and braces, it is D source.
How does D compare to C++?
D compiles to native code like C++ but adds garbage collection (optional), a module system and simpler metaprogramming, at the cost of a much smaller ecosystem.
Related formats
Sources
Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.