Basic PlantUML Syntax
Every PlantUML file requires a start and end command. These will be the first and last lines of your code. X number of them use the same command a few of the supported non-UML diagrams have their own start and end commands. The table below shows the commands for each diagram.
Diagram Type
Start Command
End Command
Sequence Diagram
@startuml
@enduml
Use Case Diagram
@startuml
@enduml
Class Diagram
@startuml
@enduml
Object Diagram
@startuml
@enduml
Activity Diagram
@startuml
@enduml
Component Diagram
@startuml
@enduml
Deployment Diagram
@startuml
@enduml
State Diagram
@startuml
@enduml
Network Diagram
@startuml
@enduml
Salt or Wireframe
@startsalt
@endsalt
Archimate Diagram
@startuml
@enduml
Gantt Chart
@startgantt
@endgantt
MindMap
@startmindmap
@endmindmap
Work Breakdown Structure
@startwbs
@endwbs
JSON
@startjson
@endjson
YAML
@startyaml
@endyaml
Example: Basic PlantUML File
Commenting Code
Code comments are ignored by the program. Use them to plan or explain to the next person (future you) what your code is doing. To comment in PlantUML, put a single quote at the beginning of the line.
Example: Commenting Code
Mixing Diagrams and Syntax Errors
PlantUML is used to make several types of diagrams. As shown above, many of them are enclosed within the same @startuml and @enduml lines. Because of this, PlantUML determines the type of diagram based on the body of your code. If you mix code from multiple types of diagrams, you may only receive a syntax error. If you continually get a syntax error and know there is nothing wrong with the particular line throwing the error, ensure you aren't accidentally using syntax from another type of diagram.
We will show this in the following three examples. The first two sets of code and images will make a proper diagram. The third set will combine the first two and throw a syntax error.
Example: Functional Sequence Diagram
Example: Functional Use Case Diagram
Example: Broken Diagram
Last updated
Was this helpful?