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).

DiagramCategoryPurposeKey symbolsChartCraft
Class diagramStructureStatic types: classes, attributes, operations and the relationships between themClass box (3 compartments), interface, generalization, association, aggregation, composition, dependency, realizationClass diagram generator · examples
Object diagramStructureA snapshot of instances and their links at one moment in timeInstance box with underlined name:Type, slot values, links—
Package diagramStructureHow model elements are grouped into namespaces and how packages depend on each otherTabbed folder, «import», «merge», dependency arrows—
Component diagramStructureSoftware components, their provided and required interfaces and how they wire togetherComponent rectangle with the two-tab icon, lollipop (provided), socket (required), port, assembly connectorArchitecture diagram generator
Composite structure diagramStructureThe internal structure of one classifier: its parts, ports and the connectors between themPart (rectangle inside the owner), port, connector, collaboration (dashed ellipse)—
Deployment diagramStructureWhich artifacts are deployed on which physical or virtual nodesNode (3-D box), device, execution environment, artifact (document icon), communication pathArchitecture diagram generator · system diagram examples
Profile diagramStructureExtending UML itself with stereotypes, tagged values and constraints for a domain«profile» package, «metaclass», «stereotype», extension (filled-triangle arrow)—
Use case diagramBehaviourWhat the system does for whom: actors, use cases and the system boundaryStick-figure actor, ellipse, system boundary box, association, «include», «extend», generalizationUse case diagram guide
Activity diagramBehaviourWorkflow or algorithm: actions, decisions, parallel flows, swimlanesInitial node, action (rounded rect), decision/merge diamond, fork/join bar, activity final, flow final, object node, swimlane partitionActivity diagram generator · swimlane generator
State machine diagramBehaviourThe lifecycle of one object: states, events, guards, actionsInitial pseudostate, state (rounded rect), transition "event [guard] / action", choice, fork/join, history (H), final stateState diagram generator · examples
Sequence diagramBehaviour · interactionMessages between lifelines over time, top to bottomLifeline, activation bar, synchronous (filled head) and asynchronous (open head) messages, dashed reply, combined fragments alt/opt/loop/parSequence diagram generator · examples
Communication diagramBehaviour · interactionThe same interaction as a sequence diagram, drawn as a graph with numbered messagesLifeline boxes, links, numbered messages "1: msg()" with small arrows—
Interaction overview diagramBehaviour · interactionAn activity diagram whose nodes are interactions or references to sequence diagramsActivity-diagram control nodes plus "ref" frames and inline "sd" frames—
Timing diagramBehaviour · interactionState or value of lifelines against a linear time axisHorizontal 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 thisNot thisGenerator
The data model, entities, their fields and relationshipsClass diagramObject diagram (it shows instances, not types)Class diagram generator
Who calls whom, in what order, for one scenarioSequence diagramCommunication diagram (same content, harder to read past ~10 messages)Sequence diagram generator
Every state an order / ticket / session can be in and what moves itState machine diagramActivity diagram (steps, not states)State diagram generator
A business process with steps, decisions and parallel workActivity diagram (with swimlanes for roles)Sequence diagram (too fine-grained for process)Activity diagram generator
What the system does for each kind of userUse case diagramActivity diagram (how, not what)Use case diagram guide
The services or modules and the interfaces between themComponent diagramClass diagram (too detailed)Architecture diagram generator
Which artifact runs on which server, container or deviceDeployment diagramComponent diagram (logical, not physical)Architecture diagram generator
Layering rules between modules of a codebasePackage diagramComponent diagram—
A concrete example configuration of objectsObject diagramClass diagram—
The internal parts of one component and their wiringComposite structure diagramDeployment diagram—
How several sequence diagrams branch and join into a flowInteraction overview diagramOne huge sequence diagram—
How long a device stays in each state, with timing constraintsTiming diagramState machine diagram (no time axis)—
A domain-specific extension of UML notationProfile 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.

SymbolNameMeaning
ClassRectangle with name, attributes and operations compartments; visibility + public, - private, # protected, ~ package
InterfaceClass box with the «interface» keyword (or a lollipop circle)
GeneralizationSolid line, hollow triangle at the parent
RealizationDashed line, hollow triangle at the interface
AssociationSolid line, optional arrowhead for navigability, multiplicities at each end (1, 0..1, *, 1..*)
AggregationHollow diamond at the whole; shared ownership
CompositionFilled diamond at the whole; exclusive ownership, part dies with the whole
DependencyDashed 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.

SymbolNameMeaning
Instance specificationRectangle with underlined "name : Type" and slots holding concrete values
LinkSolid 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).

SymbolNameMeaning
PackageFolder shape (tab on the top-left) containing elements or just a name
Package dependencyDashed 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.

SymbolNameMeaning
ComponentRectangle with the «component» keyword or the small two-tab icon in the corner
Provided interfaceLollipop: a circle on a stick — what the component offers
Required interfaceSocket: a half-circle — what the component needs
Assembly connectorLollipop plugged into a socket; the dependency is satisfied
PortSmall 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.

SymbolNameMeaning
Structured classifier with partsOuter rectangle is the owner; inner rectangles are parts (roles), joined by connectors
PortSquare on the boundary through which the owner interacts
CollaborationDashed 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.

SymbolNameMeaning
Node3-D box: a device (server, phone) or an execution environment (JVM, container, browser)
ArtifactDocument icon with a dog-ear: a deployable file (.jar, .war, container image)
Communication pathSolid 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.

SymbolNameMeaning
Metaclass / stereotypeClass box labelled «metaclass» (a UML element) or «stereotype» (your extension)
ExtensionSolid 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.

SymbolNameMeaning
ActorStick figure: a role (person or external system) that interacts with the system
Use caseEllipse: a goal the actor achieves with the system
System boundaryRectangle enclosing the use cases, named after the system
AssociationSolid 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.

SymbolNameMeaning
Initial nodeFilled circle: where the activity starts
ActionRounded rectangle: one step
Decision / mergeDiamond; outgoing edges carry [guards]
Fork / joinThick bar splitting into or joining parallel flows
Activity finalBull's-eye: the whole activity ends
Flow finalCircle with an X: this one flow ends, others continue
Object nodeRectangle: 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.

SymbolNameMeaning
Initial pseudostateFilled circle with one outgoing transition to the first state
StateRounded rectangle; may list entry / do / exit activities
TransitionArrow labelled event [guard] / action
Choice pseudostateDiamond: dynamic branch evaluated when reached
History pseudostateH in a circle: return to the last active substate (H* for deep)
Final stateBull'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.

SymbolNameMeaning
LifelineHead box with a dashed vertical line; time runs downward
Execution specificationThin rectangle on the lifeline while it is busy
Synchronous messageSolid line, filled arrowhead; the caller waits
Asynchronous messageSolid line, open arrowhead; the caller continues
ReplyDashed line, open arrowhead
Create messageDashed arrow to a new lifeline's head
DestructionX at the bottom of a lifeline
Combined fragmentFrame 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.

SymbolNameMeaning
Link with numbered messageSolid 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.

SymbolNameMeaning
Interaction use (ref)Frame tagged "ref" naming another sequence diagram
DecisionDiamond from activity notation, choosing between interactions
Initial nodeWhere 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.

SymbolNameMeaning
State lifelineA horizontal lifeline whose level changes when the state changes; time runs left to right
Duration constraintDouble-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.

SymbolNameUsed in
Note / commentAny diagram; attached with a dashed line
DependencyClass, package, component, deployment, use case («include»/«extend» are stereotyped dependencies)
GeneralizationClass, use case (actor and use case inheritance), component
FrameEvery 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.

Describe the classes, the lifecycle or the interaction. ChartCraft draws the UML.

Generate a UML diagram →