PlantUML saves as text by default, but you can export to PNG, SVG, PDF, and other formats
PlantUML diagrams are written in plain text, so the simplest save method is to store your diagram code as a .puml or .txt file. But most people need the diagram as an image — PNG, SVG, or PDF — to share or embed in documents. How you save depends on which tool you're using: the online editor, a desktop application, or a command-line interface.
The online editor at plantuml.com has a built-in export button. Desktop tools like Visual Studio Code with a PlantUML extension, or standalone applications like PlantUML Studio, let you save directly from the editor. If you work from the command line, you run a single command to convert your text file into any image format you need.
Key Takeaways
- Save your diagram code as a .puml file by using File > Save in your editor, or by copying the text into any text editor and saving with the .puml extension.
- Export to PNG, SVG, or PDF using the Export or Download button in the online editor, or through your desktop application's export menu.
- Command-line users run plantuml diagram.puml to generate a PNG, or add format flags like -tsvg or -tpdf for other formats.
- The online editor stores diagrams in your browser temporarily; save the code locally if you want to keep it permanently.
Saving your diagram code as a .puml file
Your PlantUML diagram is just text, so you can save it like any other document. In the online editor at plantuml.com, click the menu icon (three horizontal lines) and select Download as .puml. This downloads your diagram code as a text file with the .puml extension, which you can open and edit later in any text editor or PlantUML tool.
If you're using a desktop editor like Visual Studio Code with the PlantUML extension installed, open your diagram file and press Ctrl+S (Windows/Linux) or Cmd+S (Mac) to save. Name the file with a .puml extension — for example, flowchart.puml or database_schema.puml. The editor recognizes the extension and highlights the syntax automatically.
You can also paste your diagram code into any plain text editor (Notepad, TextEdit, or a code editor) and save it with the .puml extension manually. The file format itself is just text, so any editor works.
Exporting to PNG, SVG, or PDF from the online editor
The plantuml.com editor includes an export button in the top menu bar. Write or paste your diagram, then click the Export button (usually a download icon) and choose your format: PNG, SVG, or PDF. The editor generates the image and downloads it to your computer immediately.
PNG is the most common choice for sharing and embedding in documents — it's a standard image format that opens in any image viewer or document editor. SVG is a vector format that scales without losing quality, useful if you need to resize the diagram later or edit it in design software. PDF is best if you want a single file that preserves formatting for printing or archiving.
The online editor does not store your diagrams permanently. If you close the browser tab, your work is lost unless you've downloaded the .puml file or the image. Save your code locally before you leave.
Exporting from desktop applications and extensions
Visual Studio Code with the PlantUML extension shows a preview pane next to your diagram code. Right-click the preview and select Export, or use the command palette (Ctrl+Shift+P on Windows/Linux, Cmd+Shift+P on Mac) and type "PlantUML: Export". Choose your format and location, and the extension generates the file.
Standalone applications like PlantUML Studio, Lucidchart with PlantUML support, or other desktop tools have their own export menus — usually under File > Export or a similar option. The steps are similar: select your format, choose where to save, and click Export.
Desktop tools often let you set default export settings, so you can export to the same format repeatedly without choosing it each time. Check your application's preferences or settings menu for export options.
Using the command line to save diagrams
If you have PlantUML installed on your computer, you can convert a .puml file to an image from the command line. Open your terminal or command prompt, navigate to the folder where your diagram file is stored, and run:
plantuml diagram.puml
This command generates a PNG file with the same name as your .puml file — so diagram.puml becomes diagram.png. The PNG appears in the same folder as your original file.
To export to a different format, add a format flag. For SVG, run plantuml -tsvg diagram.puml. For PDF, run plantuml -tpdf diagram.puml. Other options include -ttxt for ASCII text output and -tvdx for Visio format. The command-line approach is fastest if you work with many diagrams or want to automate the process.
Choosing the right file format for your needs
Save as .puml if you plan to edit the diagram later or share it with others who use PlantUML. The text format is small, version-control friendly, and can be edited in any text editor. This is the best choice for diagrams you'll update over time.
Save as PNG if you need to share the diagram in email, documents, or presentations. PNG is widely supported and compresses well, though it's a fixed size — if you resize it, quality may suffer. Most people use PNG for final diagrams they won't change.
Save as SVG if you need to resize the diagram without losing quality, or if you want to edit it later in design software like Inkscape or Adobe Illustrator. SVG files are larger than PNG but scale infinitely and can be modified as vector graphics.
Save as PDF if you need a professional document format for printing or archiving. PDF preserves all formatting and looks the same on any device, making it ideal for formal documentation or reports.
Troubleshooting common save and export problems
If the export button doesn't appear in the online editor, your diagram may have a syntax error. Check the error message in the editor — PlantUML shows where the problem is. Fix the error and try exporting again.
If the command line doesn't recognize the plantuml command, PlantUML may not be installed or not added to your system path. On Windows, download the PlantUML JAR file and run java -jar plantuml.jar diagram.puml instead. On Mac or Linux, install PlantUML through your package manager (Homebrew on Mac, apt on Ubuntu) or use the JAR file directly.
If your exported image looks blurry or low quality, you're likely using PNG at a small size. Try exporting to SVG instead, or increase the PNG resolution by adding -Djava.awt.headless=true -DPLANTUML_LIMIT_SIZE=8192 to your command line (for advanced users). For most diagrams, the default PNG quality is sufficient.
Frequently Asked Questions
Can I save a PlantUML diagram directly as a PDF from the online editor?
Yes. Click the Export button in plantuml.com and select PDF from the dropdown menu. The editor generates and downloads a PDF file immediately. PDF export works the same way as PNG or SVG — choose your format and download.
What's the difference between saving as .puml and exporting as PNG?
Saving as .puml stores your diagram code as editable text. Exporting as PNG converts that code into a fixed image file. Save .puml if you want to edit later; export PNG if you want to share or print the finished diagram.
Does the online editor save my work automatically?
No. The online editor stores your diagram only while the browser tab is open. If you close the tab or refresh the page, your work is lost. Always download your .puml file or export an image before leaving the editor.
How do I save a PlantUML diagram in Visual Studio Code?
Press Ctrl+S (Windows/Linux) or Cmd+S (Mac) to save your .puml file. To export as an image, right-click the preview pane and select Export, or use the command palette and type "PlantUML: Export". Choose your format and location.
Can I batch export multiple PlantUML files at once?
Yes, using the command line. Run plantuml *.puml to convert all .puml files in the current folder to PNG. Add format flags like plantuml -tsvg *.puml to export all files to SVG at once. This is much faster than exporting one by one.