Encode a diagram in a URL
You can export your diagram data as a specially formatted URL. When someone clicks on this link, it opens a new copy of the diagram either in the draw.io viewer or editor, depending on the export options you selected.
Note: Your diagram is not stored as a file when exporting to a URL - the data is purely encoded in the link, and that link is always valid. Once you have shared that link with someone, you can't revoke access, unlike access to a diagram file on a cloud storage platform.
Very large diagrams may not be able to be loaded from a overly long URL as browsers have varying limits on the length of URLs they can load. If you find this happens, use Google Drive to store your diagram - when you publish a diagram publicly from Google Drive, the URL will be shorter and neater.
- Select File > Export as > URL.

- Change the export settings to suit your requirements, then click Create.
- By default, when you open the link it will create a copy of the diagram in the users' browser. If you have saved your diagram on a cloud platform, you can change this to Authorisation required, or to share the Public URL of the diagram.
- By default Links will open following the viewer's browser preferences. Select a different behaviour if you want links to always open in a new tab or a new browser window. If you want, set a different link Border Color.
- If you want to force your diagram to appear in dark or light mode on a dark background, select it from the Appearance drop down list.
- To open your diagram directly in the draw.io editor, deselect the Lightbox checkbox.
- By default, viewers can edit a copy of the diagram from the draw.io lightbox - change the behaviour or deselect the Edit checkbox.
- Deselect the Layers and/or Tags checkboxes if you don't want viewers to interact with the layers in your diagram.

- Copy the URL to share it by email or chat, or click on the Facebook button to add the link to a new post in a new browser tab. Click on Preview to open the link in a new tab. Click Close to return to the diagram editor.

How is the diagram encoded in a URL
When someone clicks on the (very long) URL with the diagram encoded in it, they will open the diagram in the diagram viewer. From there, it's easy to print or edit their own copy of the diagram - your original diagram will not be changed unless you specify otherwise.
See how a multi-page diagram is exported to a URL in the example below, and then how a user will see it in our free online diagram viewer and step through the pages.
Open this example in the our diagram viewer using the exported URL