Export Notion Data to Markdown

Updated:

There are three ways to export your Notion workspace data to Markdown:

  1. Using Notion's built-in export feature
  2. Using the Notion API
  3. Using Notion Backups

The nice thing about Markdown is that it's plain text. You can open it in any text editor or import it into other apps. Your notes aren't locked into any particular tool — including ours.

Notion's built-in export feature

Notion's native export feature, though manual, is the most straightforward way to get your data out of Notion. You can either export a single page or an entire workspace.

To export a single page, click the three-dot menu (•••) in the top-right corner and select "Export". We recommend selecting the "Everything" option in the "Include content" menu and exporting subpages as well.

Exporting a single page to Markdown in Notion (sidebar menu)
Exporting a single page to Markdown in Notion (modal)

To export an entire workspace, go to Settings > Workspace (Settings) > Export all workspace content. Select "Everything" to include all your media files. Exporting larger workspaces can take anywhere from a few hours to a few days, and it’s not uncommon for exports to occasionally fail.

Keep in mind that databases will be exported as CSV files (use Excel, Google Sheets, or Numbers for easier viewing).

Notion API

Until very recently, exporting Notion data via the API was a developer’s nightmare. You had to fetch a page, retrieve its "children" (blocks), and then use one third-party libraries to manually parse nested JSON into something readable.

Notion officially launched the Markdown Content API on February 26, allowing you to read, create, and update pages using Enhanced Markdown natively. This means no more complex block-parsing logic — just a single API call to get a clean Markdown string.

If you are building a public integration, you can now hit the retrieve a page as markdown endpoint to retrieve a page’s full content. Notion handles the conversion from blocks to Markdown themselves.

const { Client } = require("@notionhq/client");
const notion = new Client({ auth: process.env.NOTION_API_KEY });

async function getPageMarkdown(pageId) {
  const response = await notion.pages.retrieveMarkdown({
    page_id: pageId,
  });

  console.log(response.markdown);
  return response.markdown;
}

getPageMarkdown("YOUR_PAGE_ID");
Notion page ID in a URL

What is "Enhanced Markdown"?

Notion uses a flavor called Enhanced Markdown. While it supports standard syntax like # for headings and ** for bold, it uses XML-like tags for Notion-specific features that standard Markdown can't handle, such as:

  • Callouts: Rendered using ::: callout fences.
  • Columns: Wrapped in <columns> and <column> tags.
  • Toggles: Uses <details> and <summary> tags.
  • Media: Video and audio are handled via <video> and <audio> tags with pre-signed URLs.

The Limitations You Need to Know

There are a few limitations you need to be aware of when using Enhanced Markdown:

  • Public Integrations Only: Currently, the GET (Read) endpoint is restricted to public integrations. If you are using an internal workspace-level bot, you’ll still need to use the traditional block-based API.
  • Truncation: For massive pages (approx. 20,000+ blocks), the API will return a truncated: true flag. You will need to fetch the remaining parts using the unknown_block_ids provided in the response.
  • Pre-signed URLs: Image and file links in the Markdown output are temporary. If you are exporting for a long-term archive, you must download those assets immediately.

If you are working with an internal integration or need more granular control over how certain blocks are converted, the notion-to-md library is still a viable option. However, for most modern apps, the native API is now the preferred path.

Notion Backups

Notion Backups allows you to easily export your Notion data to Markdown and save it in the cloud storage provider of your choice. Unlike Notion's built-in Markdown export, our backups are exclusively in Markdown and contain no CSV files.

Make sure you check the "Back up in Markdown format" option in the workspace settings.

Back up your Notion workspaces today

Get started