---
title: "InputForm"
language: "en"
type: "Symbol"
summary: "InputForm[expr] prints as a version of expr suitable for input to the Wolfram Language."
keywords: 
- 1D format
- ascii input syntax
- linear formatting
- linear input
- unicode input syntax
- lprint
- mat2str
canonical_url: "https://reference.wolfram.com/language/ref/InputForm.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Mathematical Typesetting"
    link: "https://reference.wolfram.com/language/guide/MathematicalTypesetting.en.md"
  - 
    title: "Display of Numbers"
    link: "https://reference.wolfram.com/language/guide/DisplayOfNumbers.en.md"
  - 
    title: "Wolfram System Session History"
    link: "https://reference.wolfram.com/language/guide/WolframSystemSessionHistory.en.md"
  - 
    title: "Wolfram Client Library for Python"
    link: "https://reference.wolfram.com/language/guide/WolframClientLibraryForPython.en.md"
  - 
    title: "Converting between Expressions & Strings"
    link: "https://reference.wolfram.com/language/guide/ConvertingBetweenExpressionsAndStrings.en.md"
  - 
    title: "Numerical Evaluation & Precision"
    link: "https://reference.wolfram.com/language/guide/NumericalEvaluationAndPrecision.en.md"
related_functions: 
  - 
    title: "OutputForm"
    link: "https://reference.wolfram.com/language/ref/OutputForm.en.md"
  - 
    title: "FullForm"
    link: "https://reference.wolfram.com/language/ref/FullForm.en.md"
  - 
    title: "StandardForm"
    link: "https://reference.wolfram.com/language/ref/StandardForm.en.md"
  - 
    title: "TextString"
    link: "https://reference.wolfram.com/language/ref/TextString.en.md"
  - 
    title: "Compress"
    link: "https://reference.wolfram.com/language/ref/Compress.en.md"
  - 
    title: "BinarySerialize"
    link: "https://reference.wolfram.com/language/ref/BinarySerialize.en.md"
related_tutorials: 
  - 
    title: "Redrawing and Combining Plots"
    link: "https://reference.wolfram.com/language/tutorial/GraphicsAndSound.en.md#9501"
  - 
    title: "Forms of Input and Output"
    link: "https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.en.md#12368"
  - 
    title: "The Interpretation of Textual Forms"
    link: "https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.en.md#5202"
  - 
    title: "The Representation of Textual Forms"
    link: "https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.en.md#5084"
---
# InputForm

InputForm[expr] prints as a version of expr suitable for input to the Wolfram Language.

## Details and Options

* ``InputForm`` always produces one-dimensional output, suitable to be typed as lines of Wolfram Language input.

* The typeset form of ``InputForm[expr]`` is interpreted the same as ``expr`` when used in input. »

* When an input evaluates to ``InputForm[expr]``, ``InputForm`` does not appear in the output. »

* ``Put`` (``>>``) produces ``InputForm`` by default.

* ``Short[InputForm[expr]]`` can be used, but may generate skeleton objects that cannot be given as Wolfram Language input.

* The option ``NumberMarks`` can be used to specify whether ````` marks should be used to indicate type, precision, or accuracy of approximate numbers. »

---

## Examples (18)

### Basic Examples (2)

``InputForm`` of a typeset expression:

```wl
In[1]:= InputForm[(x/Sqrt[5]) + y^2 + 1 / z]
```

Out[1]//InputForm= x/Sqrt[5] + y^2 + z^(-1)

---

``InputForm`` of a graphic:

```wl
In[1]:= [image]//InputForm
```

Out[1]//InputForm=
Graphics[{{RGBColor[1, 0, 0], Disk[{0, 0}]}, 
  {RGBColor[0, 0, 1], Rectangle[{-1/2, -1/2}]}}]

### Scope (8)

#### Basic Objects (2)

``Integer``, ``Rational``, ``Real``, and ``Complex`` numbers:

```wl
In[1]:= Map[InputForm, {123, 1 / 23, 1.23, 1 + 23I}]

Out[1]= {InputForm[123], InputForm[Rational[1, 23]], InputForm[1.23], InputForm[Complex[1, 23]]}
```

Arbitrary‐precision ``Real`` and ``Complex`` numbers:

```wl
In[2]:= InputForm /@ N[{10 / 3, 10 / 3I}, 20]

Out[2]= {InputForm[3.33333333333333333333`20.], InputForm[Complex[0, 3.33333333333333333333`20.]]}
```

Special constants:

```wl
In[3]:= InputForm /@ {I, π, E}

Out[3]= {InputForm[Complex[0, 1]], InputForm[Pi], InputForm[E]}
```

---

Characters and strings of characters:

```wl
In[1]:= InputForm /@ {"a", "α", "⊕"}

Out[1]= {InputForm["a"], InputForm["α"], InputForm["⊕"]}
```

Control characters for strings:

```wl
In[2]:=
InputForm["A first line
A second line"]
```

Out[2]//InputForm=
"A first line
A second line"

#### Special Input Forms (4)

Different ways of representing ``Power`` expressions:

```wl
In[1]:= InputForm /@ {a ^ x, a^x, a^(1/(3)), Exp[x], 1 / x, (1/x)}

Out[1]= {InputForm[a^x], InputForm[a^x], InputForm[a^(Rational[1, 3])], InputForm[E^x], InputForm[x^(-1)], InputForm[x^(-1)]}
```

---

Special typeset expressions:

```wl
In[1]:= InputForm /@ {y'[x], ∫y[x]\[DifferentialD]x, Subsuperscript[∑, k = 1, n]y[k], Subsuperscript[∏, k = 1, n]y[k], x∈Reals, x∧y∨z}

Out[1]= {InputForm[Derivative[1][y][x]], InputForm[Integrate[y[x], x]], InputForm[Sum[y[k], {k, 1, n}]], InputForm[Product[y[k], {k, 1, n}]], InputForm[Element[x, Reals]], InputForm[(x && y) || z]}
```

---

Different list structures:

```wl
In[1]:= InputForm[{1, 2, 3}]
```

Out[1]//InputForm= {1, 2, 3}

```wl
In[2]:=
InputForm /@ {(|   |   |   |
| - | - | - |
| a | b | c |
| d | e | f |), {{a, b, c}, {d, e, f}}}

Out[2]= {InputForm[{{a, b, c}, {d, e, f}}], InputForm[{{a, b, c}, {d, e, f}}]}
```

---

Input without special interpretation:

```wl
In[1]:= InputForm /@ {Subscript[x, a], Overscript[x, a], Underscript[x, a]}

Out[1]= {InputForm[Subscript[x, a]], InputForm[Overscript[x, a]], InputForm[Underscript[x, a]]}
```

With special characters in the same positions, there may be special interpretations:

```wl
In[2]:= InputForm /@ {Subscript[x,  - ], Overscript[x, _], Underscript[x, _]}

Out[2]= {InputForm[SubMinus[x]], InputForm[OverBar[x]], InputForm[UnderBar[x]]}
```

In the case of superscripts, most things get interpreted as ``Power``:

```wl
In[3]:= InputForm /@ {x^a, Subsuperscript[x, b, a], x^†}

Out[3]= {InputForm[x^a], InputForm[Subscript[x, b]^a], InputForm[SuperDagger[x]]}
```

#### Special Output Forms (2)

Some objects use a special output representation:

```wl
In[1]:= Series[Sin[x], {x, 0, 3}]

Out[1]= SeriesData[x, 0, {1, 0, Rational[-1, 6]}, 1, 4, 1]

In[2]:= InputForm[%]
```

Out[2]//InputForm= SeriesData[x, 0, {1, 0, -1/6}, 1, 4, 1]

---

Some objects use an elided output representation:

```wl
In[1]:= i = Interpolation[{1, 2, 3, 1}]

Out[1]=
InterpolatingFunction[{{1, 4}}, {5, 3, 0, {4}, {4}, 0, 0, 0, 0, Automatic, {}, {}, False}, 
 {{1, 2, 3, 4}}, {{1}, {2}, {3}, {1}}, {Automatic}]

In[2]:= s = SparseArray[{{1, 2} -> 1}, {5, 5}]

Out[2]= SparseArray[Automatic, {5, 5}, 0, {1, {{0, 1, 1, 1, 1, 1}, {{2}}}, {1}}]
```

The elided parts are visible using ``InputForm``:

```wl
In[3]:= InputForm[i]
```

Out[3]//InputForm=
InterpolatingFunction[{{1, 4}}, {5, 3, 0, {4}, {4}, 0, 0, 0, 0, 
  Automatic, {}, {}, False}, {{1, 2, 3, 4}}, {{1}, {2}, {3}, {1}}, 
 {Automatic}]

```wl
In[4]:= InputForm[s]
```

Out[4]//InputForm= SparseArray[Automatic, {5, 5}, 0, {1, {{0, 1, 1, 1, 1, 1}, {{2}}}, {1}}]

### Options (3)

#### NumberMarks (3)

Machine numbers format without number marks by default:

```wl
In[1]:= InputForm[N[1 / 3]]
```

Out[1]//InputForm= 0.3333333333333333

The same number with number marks:

```wl
In[2]:= InputForm[N[1 / 3], NumberMarks -> True]
```

Out[2]//InputForm= 0.333333

---

Extended-precision numbers include number marks by default:

```wl
In[1]:= InputForm[N[10 / 3, 20]]
```

Out[1]//InputForm= 3.3333333333333333333

Without number marks:

```wl
In[2]:= InputForm[N[10 / 3, 20], NumberMarks -> False]
```

Out[2]//InputForm= 3.33333333333333333333

---

A mixed symbolic and numeric expression:

```wl
In[1]:= expr = N[10, 4]Sin[.25x]

Out[1]= 10.00 Sin[0.25 x]

In[2]:= InputForm[expr]
```

Out[2]//InputForm= 10.\`4.\*Sin[0.25\*x]

Include number marks for all numbers:

```wl
In[3]:= InputForm[expr, NumberMarks -> True]
```

Out[3]//InputForm= 10.\`4.\*Sin[0.25\`\*x]

Omit all number marks:

```wl
In[4]:= InputForm[expr, NumberMarks -> False]
```

Out[4]//InputForm= 10.\*Sin[0.25\*x]

### Properties & Relations (4)

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

```wl
In[1]:= {InputForm[x ^ 2]}

Out[1]= {InputForm[x^2]}
```

Copy the output and paste it into an input cell. The ``InputForm[x^2]`` is interpreted as ``x^2`` :

```wl
In[2]:= {InputForm[x^2]}

Out[2]= {x^2}
```

---

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

```wl
In[1]:= InputForm[x ^ 2]
```

Out[1]//InputForm= x^2

``Out`` is assigned the value ``x^2``, not ``InputForm[x ^ 2]`` :

```wl
In[2]:= %

Out[2]= x^2
```

---

``InputForm`` has a linear formatting:

```wl
In[1]:= InputForm[Exp[I x / n]]
```

Out[1]//InputForm= E^((I\*x)/n)

``FullForm`` has linear formatting without special syntax:

```wl
In[2]:= FullForm[Exp[I x / n]]

Out[2]//FullForm= Power[E, Times[Complex[0, 1], Power[n, -1], x]]
```

``OutputForm``, ``StandardForm``, and ``TraditionalForm`` all provide two-dimensional formatting:

```wl
In[3]:= OutputForm[Exp[I x / n]]
```

Out[3]//OutputForm= E^((I*x)/n)

```wl
In[4]:= StandardForm[Exp[I x / n]]

Out[4]//StandardForm= E^(I x/n)

In[5]:= TraditionalForm[Exp[I x / n]]

Out[5]//TraditionalForm= $$e^{\frac{i x}{n}}$$
```

---

Use ``ToString`` to generate a string in input form:

```wl
In[1]:= ToString[(1/a) + x^2, InputForm]

Out[1]= "a^(-1) + x^2"

In[2]:= Head[%]

Out[2]= String
```

### Possible Issues (1)

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

```wl
In[1]:= e = InputForm[x ^ 2]
```

Out[1]//InputForm= x^2

The output does not have ``InputForm`` in it:

```wl
In[2]:= %

Out[2]= x^2
```

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

```wl
In[3]:= FullForm[e]

Out[3]//FullForm= InputForm[Power[x, 2]]
```

The product is not evaluated due to the intervening ``InputForm`` :

```wl
In[4]:= x * e

Out[4]= x InputForm[x^2]
```

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

```wl
In[5]:= (f = x ^ 2)//InputForm
```

Out[5]//InputForm= x^2

```wl
In[6]:= x * f

Out[6]= x^3
```

## See Also

* [`OutputForm`](https://reference.wolfram.com/language/ref/OutputForm.en.md)
* [`FullForm`](https://reference.wolfram.com/language/ref/FullForm.en.md)
* [`StandardForm`](https://reference.wolfram.com/language/ref/StandardForm.en.md)
* [`TextString`](https://reference.wolfram.com/language/ref/TextString.en.md)
* [`Compress`](https://reference.wolfram.com/language/ref/Compress.en.md)
* [`BinarySerialize`](https://reference.wolfram.com/language/ref/BinarySerialize.en.md)

## Tech Notes

* [Redrawing and Combining Plots](https://reference.wolfram.com/language/tutorial/GraphicsAndSound.en.md#9501)
* [Forms of Input and Output](https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.en.md#12368)
* [The Interpretation of Textual Forms](https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.en.md#5202)
* [The Representation of Textual Forms](https://reference.wolfram.com/language/tutorial/TextualInputAndOutput.en.md#5084)

## Related Guides

* [Mathematical Typesetting](https://reference.wolfram.com/language/guide/MathematicalTypesetting.en.md)
* [Display of Numbers](https://reference.wolfram.com/language/guide/DisplayOfNumbers.en.md)
* [Wolfram System Session History](https://reference.wolfram.com/language/guide/WolframSystemSessionHistory.en.md)
* [Wolfram Client Library for Python](https://reference.wolfram.com/language/guide/WolframClientLibraryForPython.en.md)
* [Converting between Expressions & Strings](https://reference.wolfram.com/language/guide/ConvertingBetweenExpressionsAndStrings.en.md)
* [Numerical Evaluation & Precision](https://reference.wolfram.com/language/guide/NumericalEvaluationAndPrecision.en.md)

## Related Links

* [An Elementary Introduction to the Wolfram Language: Strings and Text](https://www.wolfram.com/language/elementary-introduction/11-strings-and-text.html)
* [An Elementary Introduction to the Wolfram Language: Real-World Data](https://www.wolfram.com/language/elementary-introduction/16-real-world-data.html)
* [An Elementary Introduction to the Wolfram Language: Units](https://www.wolfram.com/language/elementary-introduction/17-units.html)
* [An Elementary Introduction to the Wolfram Language: Dates and Times](https://www.wolfram.com/language/elementary-introduction/19-dates-and-times.html)
* [NKS\|Online](http://www.wolframscience.com/nks/search/?q=InputForm)
* [A New Kind of Science](http://www.wolframscience.com/nks/)

## History

* Introduced in 1988 (1.0) \| Updated in 1996 (3.0)