Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • Compute Services
  • System Modeler
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

Wolfram Consulting

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Notebook Assistant + LLM Kit
    • Compute Services
    • System Modeler
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
Part
  • See Also
    • Span
    • First
    • Head
    • Last
    • Extract
    • Position
    • ReplacePart
    • MapAt
    • Take
    • PadLeft
  • Related Guides
    • Parts of Expressions
    • Elements of Lists
    • Parts of Matrices
    • List Manipulation
    • Operations on Vectors
    • Expression Structure
    • Permutations
    • Handling Arrays of Data
    • Computation with Structured Datasets
    • Associations
    • Formula Manipulation
    • Tabular Objects
    • Wolfram Language Syntax
    • Structural Operations on Expressions
    • GPU Computing
    • Binary Data
    • GPU Computing with NVIDIA
    • GPU Computing with Apple
  • Tech Notes
    • Manipulating Elements of Lists
    • Picking Out Pieces of Algebraic Expressions
    • Getting Pieces of Lists
    • Parts of Expressions
    • Manipulating Lists by Their Indices
    • Operators
    • See Also
      • Span
      • First
      • Head
      • Last
      • Extract
      • Position
      • ReplacePart
      • MapAt
      • Take
      • PadLeft
    • Related Guides
      • Parts of Expressions
      • Elements of Lists
      • Parts of Matrices
      • List Manipulation
      • Operations on Vectors
      • Expression Structure
      • Permutations
      • Handling Arrays of Data
      • Computation with Structured Datasets
      • Associations
      • Formula Manipulation
      • Tabular Objects
      • Wolfram Language Syntax
      • Structural Operations on Expressions
      • GPU Computing
      • Binary Data
      • GPU Computing with NVIDIA
      • GPU Computing with Apple
    • Tech Notes
      • Manipulating Elements of Lists
      • Picking Out Pieces of Algebraic Expressions
      • Getting Pieces of Lists
      • Parts of Expressions
      • Manipulating Lists by Their Indices
      • Operators

expr[[i]] or Part[expr,i]

gives the i^(th) part of expr.

expr[[-i]]

counts from the end.

expr[[i,j,…]] or Part[expr,i,j,…]

is equivalent to expr[[i]][[j]]….

expr[[{i1,i2,…}]]

gives a list of the parts i1, i2, … of expr.

expr[[m;;n]]

gives parts m through n.

expr[[m;;n;;s]]

gives parts m through n in steps of s.

expr[["key"]]

gives the value associated with the key "key" in an association expr.

expr[[Key[k]]]

gives the value associated with an arbitrary key k in the association expr.

Details
Details and Options Details and Options
Background & Context
Examples  
Basic Examples  
Scope  
Single-Level Specifications  
Multilevel Specifications  
Assignments  
Input Forms  
Applications  
Properties & Relations  
Possible Issues  
See Also
Tech Notes
Related Guides
Related Links
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • Span
    • First
    • Head
    • Last
    • Extract
    • Position
    • ReplacePart
    • MapAt
    • Take
    • PadLeft
  • Related Guides
    • Parts of Expressions
    • Elements of Lists
    • Parts of Matrices
    • List Manipulation
    • Operations on Vectors
    • Expression Structure
    • Permutations
    • Handling Arrays of Data
    • Computation with Structured Datasets
    • Associations
    • Formula Manipulation
    • Tabular Objects
    • Wolfram Language Syntax
    • Structural Operations on Expressions
    • GPU Computing
    • Binary Data
    • GPU Computing with NVIDIA
    • GPU Computing with Apple
  • Tech Notes
    • Manipulating Elements of Lists
    • Picking Out Pieces of Algebraic Expressions
    • Getting Pieces of Lists
    • Parts of Expressions
    • Manipulating Lists by Their Indices
    • Operators
    • See Also
      • Span
      • First
      • Head
      • Last
      • Extract
      • Position
      • ReplacePart
      • MapAt
      • Take
      • PadLeft
    • Related Guides
      • Parts of Expressions
      • Elements of Lists
      • Parts of Matrices
      • List Manipulation
      • Operations on Vectors
      • Expression Structure
      • Permutations
      • Handling Arrays of Data
      • Computation with Structured Datasets
      • Associations
      • Formula Manipulation
      • Tabular Objects
      • Wolfram Language Syntax
      • Structural Operations on Expressions
      • GPU Computing
      • Binary Data
      • GPU Computing with NVIDIA
      • GPU Computing with Apple
    • Tech Notes
      • Manipulating Elements of Lists
      • Picking Out Pieces of Algebraic Expressions
      • Getting Pieces of Lists
      • Parts of Expressions
      • Manipulating Lists by Their Indices
      • Operators

Part

expr[[i]] or Part[expr,i]

gives the i^(th) part of expr.

expr[[-i]]

counts from the end.

expr[[i,j,…]] or Part[expr,i,j,…]

is equivalent to expr[[i]][[j]]….

expr[[{i1,i2,…}]]

gives a list of the parts i1, i2, … of expr.

expr[[m;;n]]

gives parts m through n.

expr[[m;;n;;s]]

gives parts m through n in steps of s.

expr[["key"]]

gives the value associated with the key "key" in an association expr.

expr[[Key[k]]]

gives the value associated with an arbitrary key k in the association expr.

Details

  • You can make an assignment like t[[spec]]=value to modify any part or sequence of parts in an expression. »
  • Part 0 of an expression is its head. »
  • Common spans of parts include:
  • expr[[m;;]]part m through the end
    expr[[;;n]]from the beginning to part n
    expr[[;;,j]]column j
    expr[[m1;;n1,m2;;n2]]submatrix
  • When expr is a list, expr[[{i1,i2,…}]] gives a list of parts. In general, the head of expr is applied to the list of parts. »
  • You can get a nested list of parts from expr[[list1,list2,…]]. Each part has one index from each list.
  • If any of the listi are All or ;;, all parts at that level are kept. »
  • Notice that lists are used differently in Part than in functions like Extract, MapAt, and Position.
  • If expr is a SparseArray object or a structured array such as QuantityArray or SymmetrizedArray, expr[[…]] gives the parts in the corresponding ordinary array. »
  • The form expr[["key"]] can be used to extract a value from an association whose key is a string. expr[[Key[k]]] can be used to extract values with any keys.
  • "key" and Key[k] can appear anywhere in the specification of parts.
  • In StandardForm and InputForm, expr[[spec]] can be input as expr〚spec〛.
  • 〚 and 〛 can be entered as [[ and ]] or \[LeftDoubleBracket] and \[RightDoubleBracket].
  • In StandardForm, expr[[spec]] can be input as expr[[spec]] or expr〚spec〛.

Background & Context

  • Part is a structural function that gives a specified indexed part of an expression. The expression Part[expr,i] is commonly represented using the shorthand syntax expr[[i]] or expr〚i〛. Part can be used to pick out parts of lists, a sequence of parts, elements of matrices, rows and columns of matrices, and so forth. Part can also be used to assign values to parts using Set, e.g. list[[k]]=newValue.
  • Although Part is most commonly used with lists, it works with expressions of any kind. When using Part, parts of expressions may be specified using indices, lists of indices, Span expressions, or All.
  • Useful functions that perform common special cases of Part include First, Last, Take, Drop, Rest, and Most. Position can be used to find the positions in an expression at which specified content appears. Extract is a more specialized function that extracts the part of an expression at the position specified by a given list, while the analogous function Delete removes an element from a specified position.
  • A small number of functions contain parts that cannot be accessed or divided into subexpressions using Part or related functions. The most common cases are Complex and Rational, where for example Complex[1,2] is the internal representation for numbers such as 1+2 and Rational[1,2] is the internal representation for numbers such as 1/2. Functions having this property are said to be atomic, and they return True when AtomQ is applied to them.

Examples

open all close all

Basic Examples  (6)

Pick out a part of a list:

Obtain the second element from the end of a list:

Pick out a sequence of parts:

Specify the part of an association corresponding to key "a":

Reassign a part:

Part works with expressions of any kind, not just lists:

Part always operates on the FullForm of expressions:

Scope  (24)

Single-Level Specifications  (7)

Select several parts, maintaining the head:

Obtain a list of parts, including repeats:

Parts 1 through third-to-last:

Shorter notation:

Parts 3 through third-to-last extracted in steps of 2:

Parts extracted in steps of 2 starting at the beginning:

The first part of an Association object:

The part associated with the key 1:

Take consecutive parts in an association:

Extract parts corresponding to multiple keys:

Multilevel Specifications  (7)

Pick out a part of a matrix:

This can be understood as first extracting the middle row:

This is followed by extracting the third column from that row:

The second column of a matrix:

Pick out parts 1 and 3:

Pick out parts 2 and 3 of parts 1 and 3:

Extract a subexpression from an association:

Extract several subexpressions:

Use a mixture of Key-based and numeric indices:

Extract deep parts of arbitrary expressions:

For SparseArray objects, Part gives the parts in the corresponding ordinary array:

Rows or columns are represented as sparse vectors:

Values can also be set:

For structured arrays, Part gives the parts in the corresponding ordinary array:

Parts from a QuantityArray are a Quantity object with units:

If the part is still an array, its head is preserved:

Assignments  (6)

Reassign a nested part:

Reassign a sequence of parts:

Assign several parts at once:

Assign parts 2 and 3 to be x:

Assign different values to parts 1, 3, and 4:

All standard assignment operations work on parts:

Rearrange elements by reassigning parts:

For associations, it is possible to add keys using Part:

Add a part to all the associations in a given level:

Input Forms  (4)

Enter in FullForm:

Enter a Span specification using FullForm:

Enter using [[ and ]]:

Enter as a subscript using :

Use the special characters \[LeftDoubleBracket]and \[RightDoubleBracket]:

Applications  (6)

Pick out the first solution from an equation:

Pick out all solutions for a univariate equation:

Go through the first 1000 primes, and count how many lie in each possible "mod 10 bin":

Another way to get the same result:

Apply a permutation:

Invert a permutation:

Verify the result with a direct computation using InversePermutation:

Pick out parts cyclically by using Mod with offset 1:

Properties & Relations  (10)

The zeroth part of an expression is its head:

Heads in the original expression are preserved when using a list of parts specification:

This is true even when using a multilevel specification:

Part[expr,{}] yields Head[expr][]:

For string keys, Key["key"] and "key" are equivalent:

This is not true of general keys:

Part[expr] gives expr:

Assigning to part 0 is effectively a form of Apply:

Perform the same operation using @@ (Apply):

Part[expr,m;;n] is effectively equivalent to Take[expr,{m,n}]:

Similarly, Part[expr,m;;n;;s] is effectively equivalent to Take[expr,{m,n,s}]:

Part[expr,i,j,…] is effectively equivalent to Extract[expr,{i,j,…}]:

Part can extract rectangular blocks:

Extract can return lists of parts at arbitrary positions:

Permute and Part interpret permutations differently:

The two interpretations are related by InversePermutation:

Possible Issues  (5)

Position does not return part specifications in a form that can immediately be used by Part:

Extract extracts parts specified in the way returned by Position:

When using a list of parts, successive part extraction is not always equivalent to direct part extraction:

If an expression contains held parts, extraction may cause them to evaluate:

This can lead to a difference between direct part extraction and successive part extraction:

Only parts that already exist can be reassigned:

Create a shared variable whose value is a large matrix:

Accessing its elements causes the whole matrix to be transferred to the subkernels repeatedly:

Use Unevaluated to allow the special code for parts of shared variables to see the variable:

See Also

Span  First  Head  Last  Extract  Position  ReplacePart  MapAt  Take  PadLeft

Function Repository: Slice  LookupPart

Tech Notes

    ▪
  • Manipulating Elements of Lists
  • ▪
  • Picking Out Pieces of Algebraic Expressions
  • ▪
  • Getting Pieces of Lists
  • ▪
  • Parts of Expressions
  • ▪
  • Manipulating Lists by Their Indices
  • ▪
  • Operators

Related Guides

    ▪
  • Parts of Expressions
  • ▪
  • Elements of Lists
  • ▪
  • Parts of Matrices
  • ▪
  • List Manipulation
  • ▪
  • Operations on Vectors
  • ▪
  • Expression Structure
  • ▪
  • Permutations
  • ▪
  • Handling Arrays of Data
  • ▪
  • Computation with Structured Datasets
  • ▪
  • Associations
  • ▪
  • Formula Manipulation
  • ▪
  • Tabular Objects
  • ▪
  • Wolfram Language Syntax
  • ▪
  • Structural Operations on Expressions
  • ▪
  • GPU Computing
  • ▪
  • Binary Data
  • ▪
  • GPU Computing with NVIDIA
  • ▪
  • GPU Computing with Apple

Related Links

  • An Elementary Introduction to the Wolfram Language : Operations on Lists
  • An Elementary Introduction to the Wolfram Language : Parts of Lists

History

Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2003 (5.0) ▪ 2007 (6.0) ▪ 2014 (10.0)

Wolfram Research (1988), Part, Wolfram Language function, https://reference.wolfram.com/language/ref/Part.html (updated 2014).

Text

Wolfram Research (1988), Part, Wolfram Language function, https://reference.wolfram.com/language/ref/Part.html (updated 2014).

CMS

Wolfram Language. 1988. "Part." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Part.html.

APA

Wolfram Language. (1988). Part. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Part.html

BibTeX

@misc{reference.wolfram_2025_part, author="Wolfram Research", title="{Part}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Part.html}", note=[Accessed: 04-February-2026]}

BibLaTeX

@online{reference.wolfram_2025_part, organization={Wolfram Research}, title={Part}, year={2014}, url={https://reference.wolfram.com/language/ref/Part.html}, note=[Accessed: 04-February-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English