Reference · UML 2.5.1
The 14 UML diagram types: definitions, symbols and when to use each
In short
UML 2.5.1 (OMG, 2017) defines 14 diagram types in two families. Seven structure diagrams show what exists — class, object, package, component, composite structure, deployment, profile. Seven behaviour diagrams show what happens — use case, activity, state machine, and the four interaction diagrams: sequence, communication, interaction overview, timing. In practice five carry almost all the work: class, sequence, use case, activity and state machine. The table below gives purpose and key symbols for every one; the sections after it show the symbols themselves.
Updated · by the ChartCraft team · Simbol UML (Bahasa Indonesia)
What are the 14 UML diagram types?
Structure: class, object, package, component, composite structure, deployment, profile. Behaviour: use case, activity, state machine, sequence, communication, interaction overview, timing. The last four are grouped as interaction diagrams in the UML 2.5.1 taxonomy (Annex A).
| Diagram | Category | Purpose | Key symbols | ChartCraft |
|---|---|---|---|---|
| Class diagram | Structure | Static types: classes, attributes, operations and the relationships between them | Class box (3 compartments), interface, generalization, association, aggregation, composition, dependency, realization | Class diagram generator · examples |
| Object diagram | Structure | A snapshot of instances and their links at one moment in time | Instance box with underlined name:Type, slot values, links | — |
| Package diagram | Structure | How model elements are grouped into namespaces and how packages depend on each other | Tabbed folder, «import», «merge», dependency arrows | — |
| Component diagram | Structure | Software components, their provided and required interfaces and how they wire together | Component rectangle with the two-tab icon, lollipop (provided), socket (required), port, assembly connector | Architecture diagram generator |
| Composite structure diagram | Structure | The internal structure of one classifier: its parts, ports and the connectors between them | Part (rectangle inside the owner), port, connector, collaboration (dashed ellipse) | — |
| Deployment diagram | Structure | Which artifacts are deployed on which physical or virtual nodes | Node (3-D box), device, execution environment, artifact (document icon), communication path | Architecture diagram generator · system diagram examples |
| Profile diagram | Structure | Extending UML itself with stereotypes, tagged values and constraints for a domain | «profile» package, «metaclass», «stereotype», extension (filled-triangle arrow) | — |
| Use case diagram | Behaviour | What the system does for whom: actors, use cases and the system boundary | Stick-figure actor, ellipse, system boundary box, association, «include», «extend», generalization | Use case diagram guide |
| Activity diagram | Behaviour | Workflow or algorithm: actions, decisions, parallel flows, swimlanes | Initial node, action (rounded rect), decision/merge diamond, fork/join bar, activity final, flow final, object node, swimlane partition | Activity diagram generator · swimlane generator |
| State machine diagram | Behaviour | The lifecycle of one object: states, events, guards, actions | Initial pseudostate, state (rounded rect), transition "event [guard] / action", choice, fork/join, history (H), final state | State diagram generator · examples |
| Sequence diagram | Behaviour · interaction | Messages between lifelines over time, top to bottom | Lifeline, activation bar, synchronous (filled head) and asynchronous (open head) messages, dashed reply, combined fragments alt/opt/loop/par | Sequence diagram generator · examples |
| Communication diagram | Behaviour · interaction | The same interaction as a sequence diagram, drawn as a graph with numbered messages | Lifeline boxes, links, numbered messages "1: msg()" with small arrows | — |
| Interaction overview diagram | Behaviour · interaction | An activity diagram whose nodes are interactions or references to sequence diagrams | Activity-diagram control nodes plus "ref" frames and inline "sd" frames | — |
| Timing diagram | Behaviour · interaction | State or value of lifelines against a linear time axis | Horizontal lifelines, state levels, duration and time constraints {≤ 2 s} | — |
Which UML diagram should I use?
Start from the question you need answered, not from the diagram list. Most projects need a class diagram, one or two sequence diagrams for the tricky interactions, a state machine for anything with a lifecycle, and a use case or activity diagram for stakeholders.
| You want to show… | Draw this | Not this | Generator |
|---|---|---|---|
| The data model, entities, their fields and relationships | Class diagram | Object diagram (it shows instances, not types) | Class diagram generator |
| Who calls whom, in what order, for one scenario | Sequence diagram | Communication diagram (same content, harder to read past ~10 messages) | Sequence diagram generator |
| Every state an order / ticket / session can be in and what moves it | State machine diagram | Activity diagram (steps, not states) | State diagram generator |
| A business process with steps, decisions and parallel work | Activity diagram (with swimlanes for roles) | Sequence diagram (too fine-grained for process) | Activity diagram generator |
| What the system does for each kind of user | Use case diagram | Activity diagram (how, not what) | Use case diagram guide |
| The services or modules and the interfaces between them | Component diagram | Class diagram (too detailed) | Architecture diagram generator |
| Which artifact runs on which server, container or device | Deployment diagram | Component diagram (logical, not physical) | Architecture diagram generator |
| Layering rules between modules of a codebase | Package diagram | Component diagram | — |
| A concrete example configuration of objects | Object diagram | Class diagram | — |
| The internal parts of one component and their wiring | Composite structure diagram | Deployment diagram | — |
| How several sequence diagrams branch and join into a flow | Interaction overview diagram | One huge sequence diagram | — |
| How long a device stays in each state, with timing constraints | Timing diagram | State machine diagram (no time axis) | — |
| A domain-specific extension of UML notation | Profile diagram | — | — |
What are the 7 UML structure diagrams and their symbols?
Structure diagrams show the things that exist in a system and how they are related, independent of time: classes and objects, packages, components and their interfaces, composite parts, deployment nodes and artifacts, and profiles that extend UML itself.
Class diagram
The class diagram is the UML diagram almost every project draws. Each class is a rectangle with up to three compartments (name, attributes, operations); relationships between classes are drawn as lines whose ends carry the meaning. UML 2.5.1 defines the arrowheads precisely: a hollow triangle is generalization (inheritance), a hollow diamond is aggregation, a filled diamond is composition, a dashed open arrow is dependency. Use it for domain models, ORM schemas and API object models.
| Symbol | Name | Meaning |
|---|---|---|
| Class | Rectangle with name, attributes and operations compartments; visibility + public, - private, # protected, ~ package | |
| Interface | Class box with the «interface» keyword (or a lollipop circle) | |
| Generalization | Solid line, hollow triangle at the parent | |
| Realization | Dashed line, hollow triangle at the interface | |
| Association | Solid line, optional arrowhead for navigability, multiplicities at each end (1, 0..1, *, 1..*) | |
| Aggregation | Hollow diamond at the whole; shared ownership | |
| Composition | Filled diamond at the whole; exclusive ownership, part dies with the whole | |
| Dependency | Dashed open arrow; the source uses the target |
Object diagram
An object diagram is a class diagram with the values filled in: concrete instances ("o1 : Order", underlined), their slot values and the links between them. It is the diagram to draw when a class diagram is correct but nobody can picture what a real configuration looks like — a tree of five nested Folder objects explains recursion better than a self-association ever will. Keep it small and dated.
| Symbol | Name | Meaning |
|---|---|---|
| Instance specification | Rectangle with underlined "name : Type" and slots holding concrete values | |
| Link | Solid line between instances; an instance of an association |
Package diagram
Package diagrams show the large-scale structure of a model or codebase: which packages exist, what they contain and which ones depend on which. The only subtle part is the stereotypes on the dependency arrows — «import» makes the target's public contents visible in the source namespace, «merge» combines the definitions. Teams use package diagrams to enforce layering rules (UI may depend on domain, never the reverse).
| Symbol | Name | Meaning |
|---|---|---|
| Package | Folder shape (tab on the top-left) containing elements or just a name | |
| Package dependency | Dashed arrow; stereotyped «import», «access» or «merge» |
Component diagram
Component diagrams are UML's architecture view: replaceable, encapsulated units and the contracts between them. The lollipop–socket notation is what makes them useful — you can see at a glance which interfaces are provided, which are required and which requirements are unsatisfied. Modern service architecture diagrams are informal component diagrams; ChartCraft's architecture generator draws the same structure without the UML icons.
| Symbol | Name | Meaning |
|---|---|---|
| Component | Rectangle with the «component» keyword or the small two-tab icon in the corner | |
| Provided interface | Lollipop: a circle on a stick — what the component offers | |
| Required interface | Socket: a half-circle — what the component needs | |
| Assembly connector | Lollipop plugged into a socket; the dependency is satisfied | |
| Port | Small square on the component border; a named interaction point |
Composite structure diagram
A composite structure diagram zooms into one class or component and shows the runtime parts it is made of and how they are connected. It answers "when a Car exists, what instances exist inside it and how do they talk?" — something a class diagram with composition arrows only implies. It is used heavily in systems engineering (SysML's internal block diagram is a direct descendant) and rarely in web development.
| Symbol | Name | Meaning |
|---|---|---|
| Structured classifier with parts | Outer rectangle is the owner; inner rectangles are parts (roles), joined by connectors | |
| Port | Square on the boundary through which the owner interacts | |
| Collaboration | Dashed ellipse grouping roles that cooperate to achieve something |
Deployment diagram
The deployment diagram maps software onto hardware: nodes are the machines or runtimes, artifacts are the files deployed onto them, and communication paths carry protocol labels. It is the UML answer to "where does this run?" and the formal version of the Kubernetes and cloud architecture diagrams most teams draw informally today.
| Symbol | Name | Meaning |
|---|---|---|
| Node | 3-D box: a device (server, phone) or an execution environment (JVM, container, browser) | |
| Artifact | Document icon with a dog-ear: a deployable file (.jar, .war, container image) | |
| Communication path | Solid line between nodes, labelled with the protocol |
Profile diagram
Added in UML 2, the profile diagram is a meta-level diagram: it defines new stereotypes (for example «entity», «service», «REST endpoint») that other diagrams can then apply. You will meet it if you use SysML, MARTE or a company-specific modelling profile, and almost never otherwise. The filled-triangle extension arrow is unique to this diagram.
| Symbol | Name | Meaning |
|---|---|---|
| Metaclass / stereotype | Class box labelled «metaclass» (a UML element) or «stereotype» (your extension) | |
| Extension | Solid line with a filled triangle from the stereotype to the metaclass it extends |
What are the 7 UML behaviour diagrams and their symbols?
Behaviour diagrams show what happens over time: what the system does (use case), the flow of work (activity), the lifecycle of an object (state machine), and four views of interactions between parts (sequence, communication, interaction overview, timing).
Use case diagram
The use case diagram is the requirements diagram: who uses the system and for what. Its vocabulary is tiny (actor, ellipse, boundary, four line types) and the only thing people get wrong is the direction of «include» and «extend» — include points from base to the included use case; extend points from the extension to the base. The full notation and a worked ATM example are on the use case diagram page.
| Symbol | Name | Meaning |
|---|---|---|
| Actor | Stick figure: a role (person or external system) that interacts with the system | |
| Use case | Ellipse: a goal the actor achieves with the system | |
| System boundary | Rectangle enclosing the use cases, named after the system | |
| Association | Solid line between actor and use case | |
| «include» | Dashed arrow to the use case that is always part of the base | |
| «extend» | Dashed arrow from the optional extension to the base use case |
Activity diagram
Activity diagrams are UML's flowcharts, with two things a plain flowchart lacks: fork/join bars for parallel flow and swimlanes (activity partitions) for responsibility. UML 2 reworked their semantics on token flow, which is why forks and joins behave like Petri nets. Use them for business processes, algorithms with concurrency and anything cross-functional.
| Symbol | Name | Meaning |
|---|---|---|
| Initial node | Filled circle: where the activity starts | |
| Action | Rounded rectangle: one step | |
| Decision / merge | Diamond; outgoing edges carry [guards] | |
| Fork / join | Thick bar splitting into or joining parallel flows | |
| Activity final | Bull's-eye: the whole activity ends | |
| Flow final | Circle with an X: this one flow ends, others continue | |
| Object node | Rectangle: data passed between actions | |
| Activity partition (swimlane) | Columns or rows assigning actions to a role or system |
State machine diagram
A state machine diagram describes every state one object can be in and exactly which event moves it to which other state. The transition label grammar — event [guard] / action — is what makes it precise enough to implement. Composite states, history pseudostates and orthogonal regions handle the hard cases. The how to draw a state diagram guide walks through an order lifecycle.
| Symbol | Name | Meaning |
|---|---|---|
| Initial pseudostate | Filled circle with one outgoing transition to the first state | |
| State | Rounded rectangle; may list entry / do / exit activities | |
| Transition | Arrow labelled event [guard] / action | |
| Choice pseudostate | Diamond: dynamic branch evaluated when reached | |
| History pseudostate | H in a circle: return to the last active substate (H* for deep) | |
| Final state | Bull's-eye: the object's lifecycle ends |
Sequence diagram
The sequence diagram is the most used behaviour diagram: who sends what to whom, in what order. UML 2.5.1 distinguishes the arrowheads strictly — filled is synchronous, open is asynchronous, dashed is a reply — and adds combined fragments (alt, opt, loop, par, break, ref) so conditional and repeated interactions fit on one diagram. The how to make a sequence diagram guide covers them in order.
| Symbol | Name | Meaning |
|---|---|---|
| Lifeline | Head box with a dashed vertical line; time runs downward | |
| Execution specification | Thin rectangle on the lifeline while it is busy | |
| Synchronous message | Solid line, filled arrowhead; the caller waits | |
| Asynchronous message | Solid line, open arrowhead; the caller continues | |
| Reply | Dashed line, open arrowhead | |
| Create message | Dashed arrow to a new lifeline's head | |
| Destruction | X at the bottom of a lifeline | |
| Combined fragment | Frame with an operator (alt, opt, loop, par, break, ref) |
Communication diagram
A communication diagram (called a collaboration diagram in UML 1) shows the same messages as a sequence diagram but emphasises the links between objects instead of time. Order is given by numbers (1, 1.1, 1.2, 2…) rather than vertical position. It is compact for small interactions and unreadable beyond a dozen messages, which is why sequence diagrams won.
| Symbol | Name | Meaning |
|---|---|---|
| Link with numbered message | Solid line between lifelines; messages ride on it as "1: load()" with a small arrow for direction |
Interaction overview diagram
The interaction overview diagram stitches sequence diagrams together: it uses activity-diagram control flow (initial, decision, fork, final) but its nodes are "ref" frames pointing at other interactions or inline sequence diagrams. It is the right diagram when a flow such as checkout is really five sequence diagrams with branches between them.
| Symbol | Name | Meaning |
|---|---|---|
| Interaction use (ref) | Frame tagged "ref" naming another sequence diagram | |
| Decision | Diamond from activity notation, choosing between interactions | |
| Initial node | Where the overview starts |
Timing diagram
The timing diagram flips the sequence diagram on its side: time runs horizontally and each lifeline's state is drawn as a stepped line. It exists for real-time and embedded work where the question is "how long is the device in this state?" rather than "who calls whom?". Duration and time constraints such as {≤ 2 s} are first-class notation.
| Symbol | Name | Meaning |
|---|---|---|
| State lifeline | A horizontal lifeline whose level changes when the state changes; time runs left to right | |
| Duration constraint | Double-headed arrow with a constraint in braces |
Which UML symbols are shared across diagram types?
A few symbols mean the same thing everywhere: the note, the «stereotype» guillemets, the dashed dependency arrow, the hollow generalization triangle, and the frame with a name tag in the top-left corner (sd, ref, act, stm, pkg) that UML 2 puts around any diagram.
| Symbol | Name | Used in |
|---|---|---|
| Note / comment | Any diagram; attached with a dashed line | |
| Dependency | Class, package, component, deployment, use case («include»/«extend» are stereotyped dependencies) | |
| Generalization | Class, use case (actor and use case inheritance), component | |
| Frame | Every UML 2 diagram may be enclosed in a frame; the tag names the kind: sd (sequence), act, stm, cmp, pkg, ref (reuse) | |
| Stereotype «…» | Any element; «interface», «entity», «boundary», «control» are the most common |
Which UML diagrams can be written as code?
Mermaid supports class, sequence, state and (via journey/flowchart) rough activity and use case diagrams; PlantUML supports all 14. ChartCraft draws class, sequence, state and activity diagrams from plain English instead of a DSL. Minimal Mermaid for the three most common types:
Class diagram
classDiagram
class Order {
-Decimal total
+pay() bool
}
Customer "1" --> "*" Order : places
Order ..|> Payable
Sequence diagram
sequenceDiagram
participant C as Client
participant S as Server
C->>S: GET /orders
S-->>C: 200 OK
State machine diagram
stateDiagram-v2
[*] --> Draft
Draft --> Paid : pay
Paid --> [*]
The full syntax for every Mermaid diagram type is on the Mermaid cheat sheet; if you would rather not learn a syntax at all, the how to make a UML diagram guide shows the describe-and-generate route.
Frequently asked questions
How many UML diagram types are there?
Fourteen, in UML 2.5.1: seven structure diagrams (class, object, package, component, composite structure, deployment, profile) and seven behaviour diagrams (use case, activity, state machine, sequence, communication, interaction overview, timing). UML 1.x had nine; UML 2.0 added composite structure, interaction overview, timing and package; profile diagrams were added in UML 2.2.
Who defines UML?
The Object Management Group (OMG). UML 2.5.1 (formal/2017-12-05) is the current version, and it is also ISO/IEC 19505. The 14-diagram taxonomy is in Annex A of the specification.
What is the difference between structure and behaviour diagrams?
Structure diagrams show what exists and how it is related, with no notion of time: classes, objects, components, nodes. Behaviour diagrams show what happens over time or in response to events: workflows, state changes, message exchanges.
Which UML diagrams are used most?
Class diagrams, then sequence diagrams, then use case, activity and state machine diagrams. The other nine — object, package, component, composite structure, deployment, profile, communication, interaction overview, timing — are used in specific situations or in systems-engineering settings.
What is the difference between a sequence diagram and a communication diagram?
They show the same interaction. A sequence diagram orders messages by vertical position along lifelines; a communication diagram draws the objects as a graph and orders messages with numbers (1, 1.1, 2). Sequence diagrams scale better and are far more common.
What is the difference between an activity diagram and a state machine diagram?
An activity diagram shows steps of work (actions) and the flow between them; a state machine diagram shows the states one object can be in and the events that move it between them. "Validate order → charge card → ship" is an activity; "Draft → Paid → Shipped" is a state machine.
Is a flowchart a UML diagram?
No. Flowcharts predate UML (ISO 5807, 1985) and are not part of the specification. The UML activity diagram is the closest equivalent and adds fork/join bars and swimlanes.
Can ChartCraft draw all 14 UML diagram types?
No. ChartCraft draws class, sequence, state machine and activity diagrams natively from a text description, plus flowcharts, ER diagrams, BPMN and architecture diagrams. Object, package, composite structure, profile, communication, interaction overview and timing diagrams are not supported; for those use a UML tool or PlantUML.