displays expr as a tree with different levels at different depths.


displays expr as a tree only down to level n.

Details and Options


open allclose all

Basic Examples  (3)

A symbolic expression formatted as a tree:

Show the tree form for the first two levels in the expression:

A graphics expression formatted as a tree:

Scope  (9)

A formatted symbolic expression with mathematical constants:

A formatted expression with symbolic, exact and inexact values:

A nested list:

An expression containing subscripted variables:

A formatted expression with a special superscript and OverBar:

A graphic object:

A Series expression:

An expression containing Hold:

Limit the levels shown:

Options  (14)

AspectRatio  (2)

By default a suitable aspect ratio is calculated for good visual appearance:

Change the aspect ratio:

DirectedEdges  (1)

Show directed edges:

EdgeRenderingFunction  (2)

Draw edges using blue arrows set back by 30%:

Draw vertices only:

LayerSizeFunction  (1)

Draw a tree with the first level of height 1, the second level 2, etc.:

PlotRangePadding  (1)

Use different PlotRangePadding around the drawing:

PlotStyle  (3)

Specify an overall style for the drawing:

PlotStyle can be combined with VertexRenderingFunction, which has higher priority:

PlotStyle can be combined with EdgeRenderingFunction, which has higher priority:

VertexLabeling  (1)

Display subtree expressions as tooltips:

VertexRenderingFunction  (2)

Show no vertices:

Render vertices using a predefined graphic:

VertexCoordinateRules  (1)

Explicitly specify all vertex coordinates:

Applications  (1)

Visualize the Wolfram Axiom for Boolean algebra as a tree:

Properties & Relations  (6)

FullForm gives a linear expression similar to TreeForm:

OutputForm of TreeForm gives a textual display of the expression:

Use TreePlot to plot a tree graph:

Use GraphPlot or GraphPlot3D for general undirected graphs:

Use LayeredGraphPlot for hierarchical-style drawing of directed graphs:

The typeset form of TreeForm[expr] is interpreted the same as expr when used in input:

Copy the output and paste it into an input cell. The is interpreted as x2:

When an input evaluates to TreeForm[expr], TreeForm does not appear in the output:

Out is assigned the value x2, not TreeForm[x^2]:

Possible Issues  (2)

Compound heads are not laid out as trees:

Even when an output omits TreeForm from the top level, it is not stripped from subexpressions:

The output does not have TreeForm in it:

However, the variable e does have TreeForm in it, which may affect subsequent evaluations:

The product is not evaluated due to the intervening TreeForm:

Assign variables first and then apply TreeForm to the result to maintain computability:

Neat Examples  (2)

A complete binary tree:

A complete ternary tree:

A symmetric tree:

An asymmetric tree:

Wolfram Research (1988), TreeForm, Wolfram Language function, (updated 2007).


Wolfram Research (1988), TreeForm, Wolfram Language function, (updated 2007).


Wolfram Language. 1988. "TreeForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007.


Wolfram Language. (1988). TreeForm. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_treeform, author="Wolfram Research", title="{TreeForm}", year="2007", howpublished="\url{}", note=[Accessed: 16-July-2024 ]}


@online{reference.wolfram_2024_treeform, organization={Wolfram Research}, title={TreeForm}, year={2007}, url={}, note=[Accessed: 16-July-2024 ]}