ToBoxes[expr]
generates boxes corresponding to the printed form of expr in StandardForm.
ToBoxes[expr,form]
gives the boxes corresponding to output in the specified form.
ToBoxes
ToBoxes[expr]
generates boxes corresponding to the printed form of expr in StandardForm.
ToBoxes[expr,form]
gives the boxes corresponding to output in the specified form.
Examples
open all close allBasic Examples (3)
Box representation of a polynomial:
ToBoxes[a + b ^ 2]DisplayForm[%]Box representation of a graphic:
ToBoxes[[image], StandardForm]A special function in StandardForm and TraditionalForm:
ToBoxes[Beta[a, b]]ToBoxes[Beta[a, b], TraditionalForm]Scope (8)
Basic Objects (2)
Integer, Rational, Real, and Complex numbers:
Map[ToBoxes, {123, 1 / 23, 1.23, 1 + 23I}]Arbitrary-precision Real and Complex numbers:
ToBoxes /@ N[{10 / 3, 10 / 3I}, 20]ToBoxes /@ {I, Pi, E}Characters and strings of characters:
ToBoxes /@ {"a", "α", "⊕"}Control characters for strings:
ToBoxes["A first line
A second line", StandardForm]Special Input Forms (4)
Box representations for various Power expressions:
ToBoxes /@ {a ^ x, a^x, Sqrt[a], Sqrt[a], a^(1/(3)), Exp[x], 1 / x, (1/x)}ToBoxes /@ {y'[x], ∫y[x]ⅆx, Subsuperscript[∑, k = 1, n]y[k], Subsuperscript[∏, k = 1, n]y[k], x∈Reals, x∧y∨z}ToBoxes[{1, 2, 3}]ToBoxes[(| | | |
| - | - | - |
| a | b | c |
| d | e | f |)]ToBoxes[{{a, b, c}, {d, e, f}}]ToBoxes[(| | | |
| - | - | - |
| a | b | c |
| d | e | f |), TraditionalForm]Inputs with subscripts, superscripts, etc.:
ToBoxes /@ {Subscript[x, a], x^a, Overscript[x, a], Underscript[x, a]}Special Output Forms (2)
Some objects use a special output representation with interpretation:
Series[Sin[x], {x, 0, 5}]ToBoxes[%]Some objects use an elided output representation:
Interpolation[{1, 2, 3, 2, 1}]ToBoxes[%]//ShortSparseArray[{{1, 2} -> 1}, {5, 5}]ToBoxes[%]//ShortProperties & Relations (5)
ToBoxes evaluates expr, while MakeBoxes does not:
ToBoxes[25 / 100, StandardForm]MakeBoxes[25 / 100, StandardForm]Use ToExpression to interpret boxes:
ToBoxes[1 / 10]ToExpression[%]Use DisplayForm to see how the boxes display:
ToBoxes[1 / 10]DisplayForm[%]Use formatting rules added through Format:
ToBoxes[bin[x, y]]Format[bin[x_, y_]] := MatrixForm[{{x}, {y}}]ToBoxes[bin[i, j], StandardForm]Use formatting rules added through MakeBoxes:
ToBoxes[gplus[a, b, c]]gplus/:MakeBoxes[gplus[x_, y_, n_], StandardForm] := RowBox[{MakeBoxes[x, StandardForm], SubscriptBox["⊕", MakeBoxes[n, StandardForm]], MakeBoxes[y, StandardForm]}]ToBoxes[gplus[a, b, c]]See Also
ToString ToExpression MakeBoxes HoldForm DisplayForm StandardForm TraditionalForm Format
Function Repository: StringToBoxes ToCompressedBoxes StringTemplateInput
Tech Notes
Related Guides
History
Introduced in 1996 (3.0)
Text
Wolfram Research (1996), ToBoxes, Wolfram Language function, https://reference.wolfram.com/language/ref/ToBoxes.html.
CMS
Wolfram Language. 1996. "ToBoxes." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ToBoxes.html.
APA
Wolfram Language. (1996). ToBoxes. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ToBoxes.html
BibTeX
@misc{reference.wolfram_2026_toboxes, author="Wolfram Research", title="{ToBoxes}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/ToBoxes.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_toboxes, organization={Wolfram Research}, title={ToBoxes}, year={1996}, url={https://reference.wolfram.com/language/ref/ToBoxes.html}, note=[Accessed: 13-June-2026]}