what does this symbol mean?
UML 2.5.1 A rectangle divided into three compartments: the name (Order), an attribute (+id) and an operation (+pay())

Class

A rectangle divided into compartments is a class in a UML class diagram. The top compartment holds the class's name, the next its attributes, and the one below that its operations.

Easily confused with

How to read it

The class box is the basic shape of a class diagram. The UML 2.5.1 specification draws it as a solid-outline rectangle with the class name centred in bold at the top, and compartments below the name separated by horizontal lines. The attributes compartment comes first and the operations compartment below it. No keyword is written above the name of an ordinary class; other kinds of classifier, such as an interface, carry one in guillemets («interface»). Any compartment can be left out, and the specification says that when one is, nothing can be inferred about what it holds. Robert C. Martin's 1997 tutorial on class diagrams notes that the bottom two compartments are often omitted, and that even when they are shown they seldom list every attribute and operation.

Also searched as: class box, class symbol, uml class, uml class diagram.

What the marks inside the box mean

Each attribute or operation can start with a visibility mark. Course notes at the University of Washington and Virginia Tech's OpenDSA read + as public, - as private, # as protected and ~ as package; the specification lists the same four marks. A slash before an attribute's name marks it as derived: not stored, but computed from other values. A member that is underlined is static. A class name in italics is abstract, and the specification also allows {abstract} written after or below the name.

An attribute is written as name : type, with a Multiplicity in square brackets if it has one, and an operation as name(parameters) : return type, as in +pay() : Boolean.

Three compartments or four

Textbooks teach a box of three compartments: name, attributes and operations (Martin; Kansas State University's CIS 400 textbook). UML 2.5.1 gives a class four mandatory compartments, for attributes, operations, receptions and internal structure, and allows optional ones besides. Since any compartment may be suppressed, a box showing three compartments, two, or only the name is still a class.

Look-alikes

An interface uses the same rectangle with «interface» above its name; a class that implements it is joined to it by a Realization arrow. A box whose name is underlined, or written as name : Class, is an object: one instance of a class, not the class itself. At the top of a sequence diagram, a box with a dashed line hanging from it is a Lifeline. A named rectangle on an entity-relationship diagram is an entity, from a different notation.

More UML diagram symbols

The same shape elsewhere

Sources

Researched, edited and approved by Rory Hansen before publishing. Last reviewed October 9, 2026. How we research

Added .

Report a problem

Please don’t include personal details.