Skip to main content

Overview

Excalidraw provides powerful export functionality to save drawings in multiple formats. You can export to PNG, SVG, copy to clipboard, or save as JSON with full scene data.

Export Functions

Available Export Methods

Excalidraw exposes several export utilities:

Export to PNG

Export as Canvas

Export drawing to an HTML canvas element:

Export as Blob

Export to a PNG blob for download:
From packages/utils/src/export.ts:102-164, the exportToBlob function supports PNG and JPEG formats with quality settings.

Export to SVG

Basic SVG Export

Export as scalable vector graphics:

SVG with Embedded Scene

Export SVG with embedded Excalidraw data:
From packages/excalidraw/scene/export.ts:370-383, when exportEmbedScene is true, the scene data is serialized and embedded in the SVG metadata, allowing the drawing to be re-imported.

Export to Clipboard

Copy as PNG

Copy drawing to clipboard as PNG:

Copy as SVG

Copy as SVG to clipboard:

Copy as JSON

Copy scene data as JSON:
From packages/utils/src/export.ts:199-216, exportToClipboard supports three types: “png”, “svg”, and “json”.

Export Configuration

Export Options

Customize export behavior:
1

Background

Control whether to export the background:
2

Padding

Add padding around the exported content:
3

Scale/Quality

Control export scale and quality:
4

Dark Mode

Export with dark mode styling:

Export to JSON

Serialize as JSON

Save the complete scene as JSON:
From packages/excalidraw/data/json.ts:45-68, the serializeAsJSON function takes a type parameter: "local" includes all data including files, while "database" strips sensitive data.

Export with Frames

Export Specific Frame

Export only elements within a frame:

Advanced Export Techniques

Custom Canvas Dimensions

Control export canvas size:
From packages/utils/src/export.ts:28-38, you can use the getDimensions callback to calculate custom canvas dimensions based on the content size.

Export Selection Only

Export only selected elements:

Built-in Export UI

Using Canvas Actions

Enable built-in export buttons:

Complete Export Example

Multi-Format Exporter

Next Steps

Storage

Learn how to save and load drawings

Theming

Export with custom themes

Customization

Customize export UI options

Embedding

Integrate exports in your app