File Extension File Extension Guide

What is an LDIF File?Directory

A technical reference for the .ldif extension, a file in the LDAP Data Interchange Format. What an LDIF file is, how it stores directory entries in plain text, why it holds either records or changes, and how it is used to move data between directories.

LDAP Directory 📄 Plain Text 🔁 Import and Export 📚 RFC 2849
.LDIF

LDAP Data Interchange Format

Type:Directory data
Extension:.ldif
Format:Plain text
Standard:RFC 2849
Used with:LDAP

📖 What is an LDIF File?

An LDIF file is a plain-text file in the LDAP Data Interchange Format. It uses the .ldif extension, and it carries directory information, the kind of records a directory server holds, in a simple readable form that can be moved from one system to another.

Directory servers store things like the people, groups and computers in an organisation. Their inner database is built for machines, not for reading by hand, so LDIF gives that same information a tidy text version. Because it is just text, an LDIF file travels easily and can be created, checked or edited without special software.

The format is a published standard, set out in RFC 2849, and it grew out of early directory work at the University of Michigan in the 1990s. Its name is often said aloud as "el-diff". That long history is why almost every directory server, whatever the vendor, can read and write it.

Key Characteristics

  • Plain-text directory data, in a standard layout
  • Carries entries or changes, from a directory
  • Readable and portable, across systems
  • Defined by RFC 2849, an open standard

Good to Know

  • Tied to LDAP, the directory protocol
  • Encoded as UTF-8, for wide character support
  • Widely supported, by directory servers
  • Used to move data, between directories
💡 Why it matters: Seeing an LDIF file as the text version of directory records explains what it is for. It turns the contents of a directory into something you can save, send and load elsewhere, which is why it sits at the heart of directory backups and migrations.

⚡ Quick Facts

File Extension.ldif
Full NameLDAP Data Interchange Format
CategoryDirectory data
FormatPlain text, UTF-8
StandardRFC 2849
Works WithLDAP directory servers
Two KindsDirectory entries or changes
Related Extensions.csv, .ldap

🗂️ LDAP in Brief

To make sense of an LDIF file it helps to know a little about LDAP, the world it belongs to. The two go hand in hand.

LDAP, short for Lightweight Directory Access Protocol, is the common way software talks to a directory, a specialised database of an organisation's people, groups and devices arranged in a tree. Each item in that tree, a person or a group, is an entry, and every entry has a unique address within the tree. LDIF is simply the agreed way of writing those entries down as text. So when you read an LDIF file, you are reading a slice of an LDAP directory laid out on the page.

🔍 What Is Inside

Open an LDIF file and the layout is quickly clear. It is a list of records, one after another, with a blank line between each. Every record describes one entry from the directory.

A single directory entry in LDIF

# one entry, addressed by its dn
dn: cn=Ada Lovelace,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Ada Lovelace
sn: Lovelace
mail: ada@example.com

Each record opens with a dn line, the distinguished name, which is the entry's full address in the directory tree. Below it come the entry's details as simple pairs written in an attribute: value form, such as a name, a surname or an email address. An entry can repeat an attribute to hold several values, and a special double colon marks a value that has been encoded, which is how a photo or other binary data rides along inside the text.

🔀 Entries vs Changes

Here is the point that defines the format. An LDIF file is one of two kinds, and never both at once. It either lists directory entries as they are, or it lists changes to be made to a directory.

The first kind, a content file, is a snapshot holding a set of entries, ideal for exporting a directory, backing it up, or loading it fresh into another server. The second kind, a change file, is a set of instructions instead. Each record carries a change type, saying whether to add, delete or modify an entry, so the file reads like a to-do list the directory works through. One describes what the directory contains, the other describes what to do to it.

A change record, adding one entry

dn: cn=Grace Hopper,ou=People,dc=example,dc=com
changetype: add
objectClass: inetOrgPerson
cn: Grace Hopper
sn: Hopper
💡 One file, one job: A single LDIF file holds entries or changes, not a mix. Knowing which kind you have tells you what it is for, whether it is a copy of directory contents or a list of edits waiting to be applied.
Two kinds of LDIF file, never mixed Content file entries as they are dn: cn=Ada... cn: Ada Lovelace mail: ada@... export, back up, load Change file instructions to apply dn: cn=Grace... changetype: add cn: Grace Hopper add, delete, modify

✏️ Change Records in Depth

Change files are where LDIF shows its full range. Beyond simply adding an entry, a change record can rename one or edit the individual attributes of an entry that already exists, and it does so through a small set of change types.

There are a few kinds. An add creates a new entry, a delete removes one, and a rename, written as modrdn, changes an entry's name or moves it. The richest is modify, which edits the attributes of an existing entry. Inside a modify record you spell out each edit as an add, replace or delete of one attribute, and you separate those edits with a single line holding just a dash.

A modify record editing one entry

dn: cn=Ada Lovelace,ou=People,dc=example,dc=com
changetype: modify
replace: mail
mail: ada.lovelace@example.com
-
add: telephoneNumber
telephoneNumber: +1 555 0100
⚠️ Mind the line rules: LDIF is strict about layout. A long value can be wrapped by starting the next line with a single space, which the parser joins back together, and the dash on its own line separates edits within a modify. A stray space or a missing dash is enough to break the record.
The change types in a change record add create a new entry modify edit attributes add / replace / delete split by a dash delete remove an entry modrdn rename or move an entry

🎯 Why It Is Used

The format earns its keep because it makes directory data portable. A few jobs come up again and again.

Backup

Backup

Save a directory's contents to a text file that can be kept and restored later.

Migrate

Migration

Move entries from one directory server to another, even across different vendors.

Bulk

Bulk Edits

Apply many additions or changes at once through a single change file.

Share

Interchange

Hand directory data to another tool that understands the shared format.

📂 How to Open an LDIF File

Because an LDIF file is plain text, opening one to read it is simple. Doing something with its contents is a separate step that calls for directory tools.

1

Any text editor

Notepad, TextEdit or a code editor like VS Code shows the records straight away.

2

A directory tool

An LDAP browser opens the file and lays its entries out as a readable tree.

3

The command line

Directory software ships utilities that load an LDIF straight into a server.

💡 Reading is easy, loading is deliberate: Any text editor reveals what an LDIF file contains, which is perfect for a quick look. Actually adding its entries to a directory is a separate action done with directory tools, so opening a file never changes anything on its own.

🔁 Importing and Exporting

The real work with an LDIF file is moving directory data in or out, and each directory system has its own tools for the job.

Loading entries into an OpenLDAP directory

# add the entries from a file to the directory
$ ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f entries.ldif

On open-source directories the OpenLDAP utilities do this, with commands like ldapadd that add entries or apply changes from a file, and a matching search command that writes entries back out as LDIF. On Windows, Active Directory offers its own utility for the same purpose, importing and exporting directory objects as LDIF. Email programs such as Thunderbird can also import an LDIF as an address book, since a directory of people maps neatly onto a contacts list.

On Windows the choice of tool matters. The LDIF utility handles add, modify, delete and rename operations and can even change the directory schema, while its comma-separated cousin only adds or exports entries and cannot modify or delete them. When directory data needs to land in a spreadsheet instead, an LDIF file can also be turned into CSV, either with a short script or a dedicated converter, flattening its entries into rows and columns.

🛠️ Common Issues

Trouble with an LDIF file usually traces to a small formatting slip or a mismatch with the target directory. Most cases are quick to place.

Import fails midwayA record breaks the layout, often a missing blank line between entries or a stray space. The format is strict about spacing.
Entry already existsAn add record clashes with an entry already in the directory. A change type of modify or a fresh name is needed.
Odd charactersA value looks scrambled because it is encoded binary data, marked by a double colon, not plain text to be read directly.
Rejected attributeThe directory's rules do not allow an attribute in the file. The entry must match the directory's own schema.

🔀 Related Formats

An LDIF file sits among a few formats used to carry directory and contact data.

.csvA simple table of rows and columns, another way directories and address books export data.
.vcfA vCard contact file, a text format for a single person's details, used by address books.
.jsonA general structured-data format sometimes used as an alternative when moving directory data.
.xmlA tagged text format that some directory tools use for import and export instead.
.ldapA file that stores a saved LDAP query rather than the directory data itself.

❓ Frequently Asked Questions

An LDIF file is plain text, so any text editor opens it for reading, including Notepad, TextEdit or a code editor like VS Code. That is all you need just to see what it contains. An LDAP browser can also open one and show its entries as a tidy tree. Actually loading those entries into a directory is a separate step done with directory tools rather than a text editor, so simply opening a file to look at it never changes anything.

An LDIF file is a plain-text file in the LDAP Data Interchange Format, using the .ldif extension. It carries directory information, the sort of records a directory server holds about people, groups and devices, written out in a readable, portable form. Defined in the RFC 2849 standard, it lets that data be exported, backed up and moved between directory servers, even ones from different vendors. Because it is just text, an LDIF file can be created, read and edited without special software.

LDIF stands for LDAP Data Interchange Format. LDAP is the Lightweight Directory Access Protocol, the common way software reads and writes a directory, and interchange format signals its purpose, moving that directory data between systems. The name is often said aloud as el-diff. It captures exactly what the format does, giving LDAP directory information a standard text representation that any compliant directory server can produce and consume.

An LDIF file is a list of records, one per directory entry, separated by blank lines. Each record starts with a dn line, the distinguished name, which is the entry's full address in the directory tree. Below it come the entry's details as attribute and value pairs, such as a name, surname or email address. An attribute can appear more than once to hold several values, and a double colon marks a value that has been encoded, which is how binary data like a photo travels inside the text.

An LDIF file is one of two kinds, and never both. A content file lists directory entries as they are, a snapshot suited to exporting, backing up or loading a directory fresh. A change file lists instructions instead, each record carrying a change type that says whether to add, delete or modify an entry. So a content file describes what a directory contains, while a change file describes what to do to it. Knowing which kind you have tells you what the file is for.

A DN, or distinguished name, is the unique address of an entry within a directory tree, and it begins every record in an LDIF file. It reads as a path built from parts, such as a common name followed by an organisational unit and the domain, which together pinpoint exactly one entry. Because a directory is arranged as a tree, the DN shows both who the entry is and where it sits. No two entries in a directory share the same distinguished name.

Importing means loading the file's entries into a directory server, and the tool depends on the system. On open-source directories, the OpenLDAP utilities add entries or apply changes from a file, while a matching search command exports entries back out as LDIF. On Windows, Active Directory provides its own utility to import and export directory objects as LDIF. Whichever you use, the file must match the directory's rules, so its entries and attributes have to fit the directory's schema.

Yes. Since an LDIF file is plain text, any editor can open and change it, which is one of the format's strengths. The catch is that the layout is strict, so records are separated by blank lines, spacing at the start of lines matters, and encoded values must stay intact. A small slip, such as a missing blank line, can make an import fail. So editing is fine, but it pays to keep the structure exact and to save the file as plain UTF-8 text.

The usual cause is a formatting problem, since the format is strict about layout. A missing blank line between records, an unexpected space, or a broken encoded value can stop an import partway through. Another common cause is a clash with the directory, where an entry being added already exists, or an attribute is not allowed by the directory's schema. Checking that the file's spacing is exact and that its entries fit the target directory usually clears the problem.

No, though both are plain text and both can carry directory or contact data. A CSV file is a simple table of rows and columns, flat and without structure. An LDIF file is built around the directory's tree, where each entry has a distinguished name and can carry repeating attributes and encoded values that a flat table cannot express. Directories often export to both, but LDIF preserves the full directory structure, while CSV is simpler and more limited.

A change record carries a change type that names the operation, and there are a few of them. An add creates a new entry, a delete removes one, a modify edits the attributes of an existing entry, and a modrdn renames or moves an entry. The modify type is the most detailed, since inside it you list each edit as an add, replace or delete of a single attribute, separating those edits with a line that holds only a dash. The change type is what marks a record as a change rather than plain content.

Line folding is how LDIF wraps a value that is too long for one line. You break the line and begin the continuation with a single leading space, and when the parser sees that space at the start of a line it joins the text back onto the line before, then discards the space. It lets long values stay readable without changing their meaning. The catch is that the space must be exactly one and in the right place, so an accidental space at the start of a line can join text that was meant to stand apart.

Both are built-in Windows tools for bulk directory work, but they differ in reach. The LDIF tool reads and writes LDIF files and can add, modify, delete and rename directory objects, and it can even change the directory schema. The comma-separated tool works with CSV files and can only add or export objects, so it cannot modify or delete what is already there. When you need to change or remove existing entries, or touch the schema, the LDIF tool is the one to reach for.

📝 Summary

An LDIF file is a plain-text file in the LDAP Data Interchange Format, using the .ldif extension, that carries directory information in a readable, portable form. It belongs to the world of LDAP, the protocol for working with a directory, a tree-shaped database of an organisation's people, groups and devices. Inside, an LDIF file is a list of records separated by blank lines, each starting with a dn line that gives an entry's full address, followed by attribute and value pairs for its details. The defining trait is that a file holds one of two kinds and never both. A content file lists entries as they are, for export, backup or loading, while a change file lists add, delete or modify instructions to apply to a directory. Defined by the RFC 2849 standard and encoded as UTF-8, it is supported across directory servers from different vendors, which makes it the natural choice for backups and migrations. You open a .ldif in any text editor to read it, and you load it into a directory with tools like the OpenLDAP utilities or, on Windows, the Active Directory import utility, always matching the file to the directory's own schema.