ToString[expr]
gives a string corresponding to the printed form of expr in OutputForm.
ToString[expr,form]
gives the string corresponding to output in the specified form.


ToString
ToString[expr]
gives a string corresponding to the printed form of expr in OutputForm.
ToString[expr,form]
gives the string corresponding to output in the specified form.
Details and Options

- The following options can be given:
-
CharacterEncoding "Unicode" what raw character encoding to use FormatType OutputForm default format for printing expressions NumberMarks $NumberMarks when to use ` marks in approximate numbers PageWidth Infinity number of character widths per line TotalWidth Infinity maximum number of character widths for a single expression - The default setting CharacterEncoding"Unicode" faithfully preserves all special characters in the input expression.
- ToString uses any relevant definitions given for Format and MakeBoxes. »
Examples
open all close allBasic Examples (2)
Scope (2)
Strings for OutputForm, InputForm, StandardForm, and TraditionalForm of an expression:
Options (4)
FormatType (1)
Use FormatType to change the formatting:
NumberMarks (1)
Use the default setting of InputForm formatting:
Applications (2)
Properties & Relations (3)
Use ToExpression to convert strings or boxes to expressions:
Use ToBoxes to convert expressions to boxes:
Use ToString with ToExpression to convert TeX to Wolfram Language syntax:
Possible Issues (1)
ToString by default uses OutputForm formatting:
See Also
ToBoxes ToExpression HoldForm WriteString TextString SymbolName StringTemplate
Function Repository: ToFullString
Tech Notes
Related Guides
Related Workflows
- Build a Multipage Form
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0)
Text
Wolfram Research (1988), ToString, Wolfram Language function, https://reference.wolfram.com/language/ref/ToString.html (updated 1996).
CMS
Wolfram Language. 1988. "ToString." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/ToString.html.
APA
Wolfram Language. (1988). ToString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ToString.html
BibTeX
@misc{reference.wolfram_2025_tostring, author="Wolfram Research", title="{ToString}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/ToString.html}", note=[Accessed: 08-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_tostring, organization={Wolfram Research}, title={ToString}, year={1996}, url={https://reference.wolfram.com/language/ref/ToString.html}, note=[Accessed: 08-August-2025]}