Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To export a Mermaid diagram as a PNG, use the Mermaid Live Editor for a quick one-off download, Mermaid Chart if you need to choose a transparent or custom-color background, or Mermaid CLI (mmdc) to generate PNGs from files or scripts. Check that the diagram has rendered before exporting, and keep its Mermaid source file so you can edit it later.

Choose an export method

Method Best for What you need Useful controls
Mermaid Live Editor A quick export in a browser A Mermaid definition pasted or opened in the editor PNG, SVG, or Markdown export
Mermaid Chart Hosted editing and background choices A diagram in Mermaid Chart PNG background options, plus SVG, PDF, and MMD export
Mermaid CLI (mmdc) Repeatable local or automated rendering Node.js/npm, or Docker Theme, background, size, and file-based or standard-input rendering

PNG is a practical choice for slide decks, documents, and general sharing. Because it is a raster image, it can look pixelated when enlarged. For print, large diagrams, or web embedding where scaling matters, export SVG instead; SVG is vector-based and scales without losing quality.

Export a PNG with Mermaid Live Editor

  1. Open the Mermaid Live Editor and paste your Mermaid definition into the editor, or open an existing diagram there.
  2. Wait for the preview to finish rendering. Fix any syntax or parse error shown before continuing.
  3. Open Actions and choose export PNG.
  4. Save the downloaded image where you can find it, and retain the source as a Mermaid definition or Markdown file.

This route is convenient when you only need to export a diagram once and do not want to install a command-line tool. The Actions area also offers SVG and Markdown, so you can choose a scalable image or preserve the diagram in a text-based document instead.

Export a PNG with Mermaid Chart

  1. Open the diagram in Mermaid Chart and let the preview render.
  2. Choose Export, then select PNG.
  3. Set the PNG background to the default theme background, transparent, or a custom hex color.
  4. Export the file and check the result against its destination, particularly if it will sit on a colored slide or page.

Mermaid Chart also lists SVG, PDF, and MMD as export formats. Use PNG for a convenient image in presentations and documents; use SVG when the receiving application needs to resize the diagram without raster pixelation. MMD is useful when you want a Mermaid source file rather than just an image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Keep theme styling in the diagram

If you set a theme only in editor preferences, Mermaid Chart cautions that the preference may not carry into an export. When the exported image must preserve a particular theme, put the theme configuration in the diagram’s front matter rather than relying only on the editor preference. After exporting, inspect the PNG to confirm the colors and contrast are suitable for its background.

Generate a PNG with Mermaid CLI

Mermaid CLI’s mmdc command takes a Mermaid definition as input and can produce SVG, PNG, or PDF. It is the most practical route when you need to rerender diagrams reliably, include them in a build, or process source files without manually downloading each image.

Install and render a file

Install the official npm package globally:

npm install -g @mermaid-js/mermaid-cli

Save the diagram source as input.mmd, then render it:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
mmdc -i input.mmd -o output.png

The command reads the Mermaid definition from input.mmd and writes the PNG to output.png. Make sure the input path exists and the output directory is writable. Keep the original .mmd file alongside the PNG if you expect to revise the diagram.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set a dark theme and transparent background

For a dark-theme diagram with a transparent background, use:

mmdc -i input.mmd -o output.png -t dark -b transparent

The theme and background are separate choices: -t dark selects a theme, while -b transparent requests a transparent output background. Check the PNG in the application where it will be used; transparency is especially useful when placing the diagram over a colored slide or page.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Increase the output size

To request a larger output, the CLI documents this example:

mmdc --input input.mmd --output output.png --size 4000

A larger render can help when the image needs to appear bigger or text is difficult to read, but it also increases the image dimensions and may increase file size. If the destination needs substantial resizing or print-quality scaling, SVG is often the more suitable format.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use standard input, a local install, or Docker

The CLI also accepts Mermaid text from standard input. It can be installed locally rather than globally, or run through Docker. These options can fit a project-specific development environment or an automated workflow; use the project’s documented setup for the environment you choose. The file-based commands above are the simplest place to start when you are new to mmdc.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Make the PNG fit its destination

Choose the background deliberately

  • Transparent: choose this when the image must sit over a colored slide, page, or other artwork without a solid rectangle behind it.
  • Custom color: in Mermaid Chart, choose a custom hex color when the PNG needs a specific solid background.
  • Default theme background: use the default when the diagram should retain the background associated with its selected theme.

Before sharing, view the exported image against the actual destination background. A diagram that looks clear in an editor preview may have insufficient contrast once placed in a document or presentation.

Choose a theme that survives export

For Mermaid Chart exports, place required theme configuration in the diagram’s front matter if editor-only preferences do not carry through. With Mermaid CLI, specify a theme in the command when needed, as in -t dark. Compare the finished PNG with the rendered preview rather than assuming the export inherited every editor setting.

Use enough resolution

If labels look too small or edges look rough at the intended display size, increase the render size when the tool provides a control. The Mermaid CLI’s documented --size 4000 example requests a larger render. For output that must be enlarged considerably, SVG avoids the quality loss associated with scaling a PNG.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not a Mermaid-code renderer. If your diagram is already rendered on a web page you can access, ScreenshotNeo can capture that page; it will not turn a raw .mmd definition into a diagram by itself. For example, replace the example URL below with the URL of your rendered diagram page. See the ScreenshotNeo API documentation for request options and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/diagram -o shot.webp

Cookie banners, newsletter popups, and chat widgets are removed before the shot, and each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing; the response identifies the page verdict and billing status in headers. An MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan to capture rendered diagram pages by URL.

Troubleshooting Mermaid PNG exports

  • The export is empty or never appears: wait for the preview to finish rendering and resolve any parse error before exporting. A source definition that does not render correctly cannot produce the intended diagram image.
  • Text is clipped or hard to read: increase the output size when available, then inspect the PNG at its actual display size. Use SVG instead if the image needs to scale substantially.
  • The background is the wrong color: select transparent or a custom hex color in Mermaid Chart’s PNG options, or use the CLI’s documented -b transparent option.
  • The exported theme does not match the editor: in Mermaid Chart, editor-preference theme settings may not persist to export. Put the theme configuration in diagram front matter; with the CLI, pass the intended theme, such as -t dark.
  • mmdc cannot find the input: confirm that the file is named and located as the command expects, or provide the correct input path with -i or --input.
  • The CLI cannot write the image: check that the output path is valid and its directory is writable, then rerun with the intended destination after -o or --output.
  • You need to edit the diagram later: keep the .mmd or Markdown source. A PNG is a finished image, not a substitute for the editable Mermaid definition.

Which route should you use?

  • Choose Mermaid Live Editor for the fewest setup steps and a one-off PNG export.
  • Choose Mermaid Chart when you want hosted editing and explicit PNG background choices, including transparent or custom color.
  • Choose Mermaid CLI when rendering needs to be repeated from source files or incorporated into a developer workflow.
  • Choose SVG rather than PNG when the main requirement is resizing for print, a large diagram, or web embedding without loss of sharpness.

Frequently Asked Questions

Can I export Mermaid source code as an image?

Yes. The Live Editor, Mermaid Chart, and Mermaid CLI render a Mermaid definition and export the resulting diagram as an image; the CLI command shown above uses an .mmd input and a .png output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I make a Mermaid PNG transparent?

Yes. Mermaid Chart provides a transparent option in PNG export settings, and Mermaid CLI documents the `-b transparent` option.

Will a PNG remain editable as a Mermaid diagram?

No. Keep the original Mermaid definition in an .mmd file or Markdown document if you need to edit the diagram.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.