Skip to main content

Dynamic Diagram β€” Share with a Link (No Account Needed)

What is Dynamic Diagram?​

Dynamic Diagram lets you share and open a diagram directly from a link. The link contains your DBML in a safe encoded format, so nothing is saved to an account or server.

  • Key benefits: Share quick, stateless diagrams without creating or persisting a diagram in the app.
  • Perfect for: Docs, wikis, tickets, chats, and one-off reviews.

How it Works​

  1. You write DBML.
  2. You encode it and place it into our dbdiagram.io/embed link as a ?c= parameter.
  3. Share or embed the link:
    • Share directly: Send the link to anyone and they'll see the rendered diagram instantly
    • Embed in sites: Add the link to an iframe to display the diagram inline in your docs, wikis, or apps

Quick Start​

Create the link yourself by encoding your DBML and appending it to /embed?c=.

Step 1 β€” Encode your DBML​

  • The c parameter must be: Base64 of your DBML (UTF‑8) and then URL-encoded.

JavaScript (Node.js or browser console):

const dbml = `
Table users {
id int [pk]
name varchar
}

Table orders {
id int [pk]
user_id int [ref: > users.id]
total int
}
`;

// Unicode-safe: UTF-8 β†’ base64 β†’ URL-encode
const base64 = btoa(unescape(encodeURIComponent(dbml)));
const c = encodeURIComponent(base64);
https://dbdiagram.io/embed?c=<value of c>

Share the link anywhere: docs, tickets, chat, emails.

Step 3 (Optional) - Embed in your site with an iframe​

Add the generated link to an iframe to render the diagram inline in your docs, wikis, or apps.

<iframe
src="https://dbdiagram.io/embed?c=ENCODED_DBML"
width="100%"
height="600"
style="border: 0"
loading="lazy"
allowfullscreen
></iframe>

Tips:

  • Adjust height to fit your content.
  • Use width="100%" for responsive layouts.

Live Example​

The iframe below renders the example DBML from the steps above using an actual encoded c parameter:

Best Practices​

  • Keep DBML concise: Very large diagrams may exceed URL length limits in some browsers or tools. We'll try to solve this content length limitation in the future.
  • Great for review: Use in PRs, sprint tickets, and doc pages to align quickly.

Privacy & Security​

  • The DBML is embedded in the URL; anyone with the link can view it.
  • There’s no server-side persistence for these links.
  • Avoid including secrets or sensitive data in DBML if the link could be shared broadly.

Integrations​

We also implement packages to help users easier in embed their diagrams:

Feel free to share your feedback or recommendations for how we may enhance this feature in our community discussion.