Templates
Types
EN

AI UML Class Diagram Generator from Text

Describe classes, attributes, and inheritance. Get a Mermaid UML class diagram.

Try one of these — click to open in the generator

When to use AI UML Class Diagram Generator from Text

Building a UML class diagram from text, from one vague sentence

A one-line prompt will give you a box for every noun you mentioned. What it guesses at is the arrows — inheritance or interface, composition or aggregation, all of which read the same in English prose. Chat mode asks about the one arrow that changes the design, draws the rest, and then lists every arrow it chose on your behalf. Here is the outbound notification service of a mid-sized SaaS, built from a deliberately vague opening line.

Draw a class diagram for our notification service.
AskUserQuestion
Do the channels share an abstract base class with the retry logic in it, or do they each implement a common interface and bring their own transport client?
Common interface, each channel owns its transport client
Abstract base class with shared retry logic
First draft. The ..|> on the three channels came straight from your answer. Every other arrow — including the *-- between Notification and DeliveryAttempt — is the model's own reading, and it says so below rather than asking.
First draft. The ..|> on the three channels came straight from your answer. Every other arrow — including the *-- between Notification and DeliveryAttempt — is the model's own reading, and it says so below rather than asking.
I filled in a few things you didn't mention
  • Read "notification service" as the outbound delivery pipeline, not the in-app feed users read
  • Made DeliveryAttempt records die with their Notification (*--) rather than surviving as an audit log
  • Typed Notification.vars as Map<string, string> — you never said what shape template variables take
  • Gave Channel a supports() method so dispatch() has something to select on
  • Added a priority: int field to Notification
  • Modelled the dispatcher as owning its channels (*--), so channels die with it
Looks goodRemove 1
Dropped the priority field from Notification. The other three are still in the diagram.
Channels are registered once at boot from config and shared by every dispatcher instance — they don't die with it, so that relation is aggregation, not composition. Give the dispatcher a RetryPolicy it consults (maxAttempts, backoffMs). And don't put priority or scheduling fields back on Notification — the campaign service owns those.
Final version. One relation went from *-- to o--; the composition between Notification and DeliveryAttempt stayed, because that one you confirmed.
Final version. One relation went from *-- to o--; the composition between Notification and DeliveryAttempt stayed, because that one you confirmed.

Five replies produced a class diagram where every arrow has a reason: ..|> for the channel contract, *-- for attempts that die with their notification, o-- for channels that outlive the dispatcher. A one-shot prompt picks an arrow for each of those too — it just never tells you which one it picked, and a wrong *-- reads as a lifecycle guarantee your code does not actually make.

Start this conversation →Opens the generator in chat mode with the first message already filled in.

Deep dive

Class diagrams are the standard vocabulary for talking about software structure. Reach for them when you need to communicate the shape of an object-oriented codebase: which types exist, what attributes and methods they have, and how they relate through inheritance, composition, and association.

Where they shine: onboarding docs ("here's how our domain model is organized"), design RFCs proposing a new class hierarchy or refactor, and technical interviews where you need to sketch out a design in the whiteboard. They're also the go-to for documenting design patterns — factory, strategy, observer, visitor all have a canonical class diagram shape that readers recognize instantly.

Mermaid's classDiagram supports the full UML notation you'd expect: visibility markers (`+` public, `-` private, `#` protected, `~` package), abstract classes and methods, interfaces via the `<<interface>>` stereotype, generic types, and every relationship (inheritance `<|--`, composition `*--`, aggregation `o--`, association `--`, dependency `..>`). It stops short of full UML — no swimlanes, no full activity semantics — which for most engineering docs is a feature, not a bug. If you need those, you're probably reaching for the wrong tool.

Ready to try it yourself?

Prefer a conversation?

Not sure how to phrase your prompt? Chat mode lets AI ask 2-3 clarifying questions about actors, events, and edge cases — then draws.

Try Chat to Diagram

Want to draw better diagrams?

Read our in-depth tutorials — symbols, structures, 9 rules, and copy-paste prompt templates for real-world flows.

Read the tutorials

Related tools