.DTD file extension

To open .DTD files on Windows, open the .dtd file with a text editor (e.g., Notepad) to view or edit it as plain text.

To open a .dtd file, use a text editor (for viewing/editing) or an XML editor/IDE (for validation and navigation). A .dtd file is plain text that defines rules used by an XML document’s document type declaration (DOCTYPE).

Last updated: April 30, 2026 · Reviewed by Julian Stricker

Open on your device

Choose your operating system for a dedicated step-by-step opening guide.

How to open .DTD files

Use these platform-specific instructions to open .DTD files safely.

Windows

  1. Open the .dtd file with a text editor (e.g., Notepad) to view or edit it as plain text.
  2. If you need validation context, open the related XML file in an XML editor/IDE and ensure it can resolve the external DTD reference (the editor will load the .dtd).
  3. If Windows asks for an app, choose a text editor rather than renaming the file extension.
Full Windows guide

Mac

  1. Open the .dtd file with a plain-text editor (e.g., TextEdit set to plain text) to view/edit.
  2. For structure-aware help, open the related XML document in an XML-capable editor and let it load the external DTD reference.
  3. If you only need to inspect contents, Quick Look may show text; otherwise open in a text editor.
Full Mac guide

Linux

  1. Open the .dtd file in a text editor (e.g., a default GUI editor) since it is plain text.
  2. If file associations are wrong, use “Open With” and select a text editor; Linux desktops rely on MIME/extension mappings maintained via the shared-mime-info system.
  3. For validation, open the XML file that references the DTD in an XML tool/editor and confirm the DTD path/URL is reachable.
Full Linux guide

iOS

  1. In Files, tap the .dtd file to preview; if it does not display well, use Share/Open In to send it to a plain-text editor app, or transfer it to a desktop for XML validation.
Full iOS guide

Android

  1. Open the .dtd file in a text/editor app that can display plain text; for validation or resolving external references, transfer the DTD and its XML document to a desktop XML editor.
Full Android guide

Security notes

  • Be cautious when opening XML files that reference external DTDs: XML parsers may fetch external entities or external DTD subsets, which can leak data or trigger unexpected network access if untrusted inputs are processed (a common risk area when DTD/entity processing is enabled).
  • .dtd files can define entities that expand into large text (entity expansion), which can cause performance or memory issues in parsers when processing untrusted documents; prefer secure parser settings that limit/disable DTD and external entity processing for untrusted content.
  • Treat DTDs as code-like configuration for parsers/validators rather than harmless “data”: only allow automatic resolution of external DTD references from trusted locations.

Recommended antivirus software

Scan files before opening them. These antivirus tools help protect against malware and viruses.

We may earn a commission when you use affiliate links. This supports our free file extension guides.

Can't open this file?

These are the most common causes and fixes when .DTD files fail to open.

Common reasons

  • The .DTD file opens as unreadable characters or a single long line
  • XML validation fails because the DTD cannot be found or loaded
  • Your system asks what app to use, or the file association is wrong

Fix steps

  1. Open the file in a different text editor that lets you choose or auto-detect encoding.
  2. If you received it alongside an XML document, check whether the XML or documentation specifies an expected encoding.
  3. Re-save as plain text (without rich-text formatting) if your editor accidentally saved it as a formatted document.

What is a .DTD file?

A .dtd file contains a Document Type Definition (DTD): a set of markup declarations (elements, attributes, entities) used to describe the structure of documents in the XML/SGML family. In XML, the DOCTYPE can include an internal subset or reference an external DTD file, which is commonly stored with the .dtd extension. DTDs are not “data” in the sense of records; they are schema/grammar files used by parsers and validators.

Background

In XML, a document type declaration (DOCTYPE) may point to an external DTD that defines what markup is valid for that document. The W3C XML specification defines the role of the document type declaration and the grammar it contains or references as the DTD.

The Library of Congress format description notes .dtd as a common filename extension for XML Document Type Definitions and describes DTDs as external declarations used by XML/SGML-family documents. In practice, DTDs are widely encountered in publishing workflows, structured documentation, and older XML systems that use DTD-based validation.

Because .dtd files are plain text, they can be opened and edited in many editors. Their “behavior” is realized when an XML parser or validator reads an XML file that references the DTD and applies its declarations (including entity definitions).

Common MIME types: application/xml-dtd

Further reading

Authoritative resources for more details on the .DTD format.

Common .DTD issues

The .DTD file opens as unreadable characters or a single long line

Most .dtd files are plain text, but the editor may be using the wrong encoding or may not handle line endings/formatting well.

  1. Open the file in a different text editor that lets you choose or auto-detect encoding.
  2. If you received it alongside an XML document, check whether the XML or documentation specifies an expected encoding.
  3. Re-save as plain text (without rich-text formatting) if your editor accidentally saved it as a formatted document.

XML validation fails because the DTD cannot be found or loaded

An XML file may reference an external DTD using a relative path or a URL; validation fails if that reference cannot be resolved from your current location or network environment.

  1. Keep the .dtd file in the expected directory relative to the XML file, or update the XML’s DOCTYPE system identifier to the correct path.
  2. If the DTD is referenced via URL, ensure your tool is allowed to fetch external resources or provide a local copy and point to it.
  3. Check that any referenced subsidiary files (e.g., other DTD modules) are also present if the DTD includes/expects them.

Your system asks what app to use, or the file association is wrong

.dtd is a specialized text-based schema file and may not have a default associated application.

  1. Choose a plain-text editor as the default for viewing/editing the file.
  2. On Linux, ensure your desktop MIME database/file associations recognize the extension and map it appropriately (shared-mime-info-based systems control this).

FAQ

What is a .dtd file used for?

It defines the allowed structure and declarations (elements, attributes, entities) for an XML/SGML-family document. An XML file can reference it in the document type declaration (DOCTYPE) so validators and some tools can check the document against those rules.

Is a .dtd file the same as an XML Schema (.xsd)?

No. Both describe document structure, but DTD is the older XML/SGML-family mechanism defined around the document type declaration, while XSD is a different schema language with different capabilities and syntax.

Can I open and edit a .dtd file in a regular text editor?

Yes. DTD files are plain text and can be edited with any text editor, though an XML-aware editor can provide better navigation and validation workflows.

What is the correct MIME type for .dtd?

The registered media type is application/xml-dtd (defined in the IANA Media Types Registry and specified in RFC 7303).

Similar file extensions

Compare related formats in the same category to find the right tool faster.