Multilingual Wiki Documentation

You are currently using syntax.
In an attempt to improve PlantUML documentation...
Please do not use this website for your own diagrams.
You can click here and use the online server here for your own documentation.

Recent changes    Wiki Toc    View page history    Add new chapter    Reorder page    Raw

PlantUML Text Encoding

Introduction

PlantUML defines a standardized way to encode diagram text description to a simple string of characters that contains only digits, letters, underscore and minus character. The goal of such an encoding is to facilitate communication of diagrams through URL (see Server). This encoding includes compression to keep encoded strings as short as possible.

The encoded metadata is stored in the generated PNG, so the diagram source can be extracted from the diagram itself!! (see Server#metadata).

Compression

Two possible algorithms are available. The first one is the Deflate algorithm. This compression gives good results for short diagrams. This was initially the only compression algorithm available.

Starting from version 1.2017.20, PlantUML supports also Brotli algorithm which gives usually better results than Deflate for larger diagrams. An initial 0 character is added to the encoded String to indicate that Brotli has to be used for decoding (Deflated data never starts by a 0).

Principle

For example, the following uml text description:

Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

is encoded as:

To achieve such an encoding, the text diagram is:

  1. Encoded in UTF-8
  2. Compressed using Deflate or Brotli algorithm
  3. Reencoded in ASCII using a transformation close to base64

Compression comparison

The following diagram:

@startuml
skinparam backgroundColor #EEEBDC
skinparam handwritten true

skinparam sequenceArrowColor DeepSkyBlue
skinparam sequenceActorBorderColor DeepSkyBlue
skinparam sequenceLifeLineBorderColor blue
skinparam sequenceLifeLineBackgroundColor #A9DCDF
skinparam sequenceParticipantBorderColor DeepSkyBlue
skinparam sequenceParticipantBackgroundColor DodgerBlue
skinparam sequenceParticipantFontName Impact
skinparam sequenceParticipantFontSize 17
skinparam sequenceParticipantFontColor #A9DCDF
skinparam sequenceActorBackgroundColor aqua
skinparam sequenceActorFontColor DeepSkyBlue
skinparam sequenceActorFontSize 17
skinparam sequenceActorFontName Aapex

actor User
participant "First Class" as ParticipantA
participant "Second Class" as ParticipantB
participant "Last Class" as ParticipantC

User -> ParticipantA: DoWork
activate ParticipantA

ParticipantA -> ParticipantB: Create Request
activate ParticipantB

ParticipantB -> ParticipantC: DoWork
activate ParticipantC
ParticipantC --> ParticipantB: WorkDone
destroy ParticipantC

ParticipantB --> ParticipantA: Request Created
deactivate ParticipantB

ParticipantA --> User: Done
deactivate ParticipantA
@enduml

is compressed to a

Running

You can use -encodeurl or -decodeurl in the command line flags to encode or decode the text.

You will find here some implementation of this encoder:


Please report any bugs to plantuml@gmail.com or here.
This website is still in beta testing.