Evernote Tech Blog

The Care and Feeding of Elephants

How Evernote’s XML Export Format Works

Evernote notes can be exported from our Windows and Mac clients using two different output formats: HTML and ENEX.

HTML produces a web page (or series of web pages) containing all of the exported notes, as well as any included Resources (images, files, etc.). This format is useful for sharing Evernote content with just about anybody, even folks who don’t use Evernote. The Evernote software is not able to import notes exported as HTML.

ENEX produces an XML document that can be imported back into Evernote. In this post, we’re going to describe this format in detail.

Using ENEX export files

There are several potential uses for exported notes:

  • Backup
  • Migrating data between accounts
  • Archiving notes that you don’t want in your account and would rather not delete

While it may seem like a reasonable use case, developers should avoid creating or changing notes by manipulating ENEX files. Due to typos, incorrect formatting and simple human error, many types of errors can be introduced when modifying these files by hand. The Evernote API provides a simpler means of creating and modifying notes and is the preferred method for doing so.

The ENEX file format and specification

The ENEX file format is formally defined by version 3 of the Evernote Export doctype declaration. A note exported as ENEX is complete and can be imported back into Evernote exactly as it was exported; this includes all attached files, recognition information and tags (optionally).

Here is an example ENEX file. Let’s take a look at how the file is organized and what data it contains.

Below the XML declaration and the aforementioned doctype declaration, we have the en-export element. The export-date, application, and version attributes of en-export define the date and time the note was exported, the application where the export originated and the specific version of the exporting application. The first—and, in our example, only—child element of en-export is note (if multiple notes had been exported to this ENEX file, each would have its own note element). Within this element, we’ll find all of the data stored in the exported note:

  • title contains the title of the note
  • content encompasses the body of the note in its raw ENML form, wrapped in CDATA tags.
  • created and updated describe the date and time the note was created and most recently updated, respectively.
  • The export may contain zero or more tag instances; each instance represents a tag that was applied to the note before the note was exported.
  • The note-attributes element may contain location information, if available (like latitude, longitude and altitude), as well as other data (including the note’s author, in this example).

For each Resource contained in the note, there will be a corresponding resource element within note which will be comprised of the following child elements:

  • data is a base64-endcoded version of the Resource.
  • mime is the MIME type of the Resource.
  • width and height will be set if the Resource can be displayed inline (e.g., images and PDFs).

If there are any Resources in the note or notes being exported, a resource-attributes for each Resource will be present and, depending on the type of Resource, contain one or more optional child elements:

  • source-url is the web URL where the note was originally clipped.
  • If the device used to capture embeds it in the original file, the timestamp and file-name values will be set.
  • The latitude, longitude, and altitude where the Resource was created.
  • camera-make and camera-model for Resources originating from a camera that embeds such information in its photos.
  • attachment is a boolean value controlling whether the Resource is displayed as an attachment or inline (if possible).
  • application-data is a 4kb field where third-party developers can store data for their own purposes (restrictions apply; make sure to read the documentation before attempting to use this field).

As described in the Resources documentation, each Resource will be embedded in the content element using the en-media tag. Depending on the type of Resource, the en-media tag will include attributes that govern size, filename, and other visually-relevant information about the Resource. See the documentation for more information on constructing valid en-media elements.

Additional thoughts

  • ENEX files do not represent how notes are stored within the Evernote service or applications; they are a portable export format that allows notes to be migrated in their entirety between systems and accounts.
  • base64-encoded data can be converted back to its original form. Here’s a quick and dirty example of how to do this.

If you have any questions about the ENEX file format, drop us a line or leave a comment below!

  1. I am creating student portfolios using evernote. I want kids to record reflections using the evernote app along with a picture of their work. I would like the ability at some point be able to somehow export the recording to google drive or google site. Is there a way I can export an enex file on the computer?

  2. I’m working with the Universal Decimal Classification Consortium (like Dewey Decimal at the Library) to try to import the UDC into Evernote as tags. I’m not very good with programming, but I understand enough to think it’s possible.

    I can get them all as an xml file if that will help. I know evernote enex files use xml. I’d be grateful for any assistance you can offer.

  3. When I multi-select notes and choose “Export”, I get a file. However, when I perform an import from another system, it appears as if I get only the first note.

    I saw some human-readable content in the XML indicating that only a single note was exported.

    Is it possible to create an enex file representing a batch of multi-selected notes?

    Tom

  4. Are there any tools for importing databases into Evernote by converting to ENEX format and creating notebooks? For example, I would like to convert the public Sefaria.data base (http://www.sefaria.org/) which is freely ex[portable
    Database is at https://github.com/blockspeiser/Sefaria-Data

    • Sounds interesting, but I don’t know of any general tools for that.
      On the desktop clients (e.g. Windows), you may also be able to automate HTML->Note via the client, so if the data source was formatted as clean HTML, that might be another option.


Leave a Comment

* Required fields