This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


gives the number of elements in expr.
  • When expr is a SparseArray object, Length[expr] returns the length of the corresponding ordinary list. »
Find the length of a list:
Find the length of a list:
Click for copyable input
Length works with any head:
Length[expr] gives the number of elements in the top level of expr:
The length of a symbol is 0:
The length of a string is 0:
StringLength gives the number of characters:
Explicit numbers have length 0:
Length works on SparseArray objects:
Find the number of rows in a matrix:
Find the length of each sublist:
Find the number of terms in a polynomial:
Find the number of digits in 1000!:
Get the number of points used to plot a curve:
Length gives the maximum index that can be used:
Length operates on the FullForm of expressions, not their displayed form:
Rational and complex numbers are atoms, so they have length 0:
Numeric expressions are treated like other expressions, not like explicit numbers:
Length counts only "arguments", not parts of heads:
For nonatomic e, Length[e] is equivalent to First[Dimensions[e]]:
New in 1 | Last modified in 5