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
Partition
  • See Also
    • Flatten
    • ArrayReshape
    • Multicolumn
    • TakeList
    • TakeDrop
    • RotateLeft
    • Split
    • SplitBy
    • Gather
    • GatherBy
    • BlockMap
    • Groupings
    • Take
    • PadLeft
    • ListConvolve
    • MovingAverage
    • CellularAutomaton
    • FindClusters
    • StringPartition
    • ImagePartition
  • Related Guides
    • Rearranging & Restructuring Lists
    • Constructing Matrices
    • Image Filtering & Neighborhood Processing
    • List Manipulation
    • Handling Arrays of Data
  • Tech Notes
    • Grouping and Combining Elements of Lists
    • Nested Lists
    • Partitioning and Padding Lists
    • See Also
      • Flatten
      • ArrayReshape
      • Multicolumn
      • TakeList
      • TakeDrop
      • RotateLeft
      • Split
      • SplitBy
      • Gather
      • GatherBy
      • BlockMap
      • Groupings
      • Take
      • PadLeft
      • ListConvolve
      • MovingAverage
      • CellularAutomaton
      • FindClusters
      • StringPartition
      • ImagePartition
    • Related Guides
      • Rearranging & Restructuring Lists
      • Constructing Matrices
      • Image Filtering & Neighborhood Processing
      • List Manipulation
      • Handling Arrays of Data
    • Tech Notes
      • Grouping and Combining Elements of Lists
      • Nested Lists
      • Partitioning and Padding Lists

Partition[list,n]

partitions list into nonoverlapping sublists of length n.

Partition[list,n,d]

generates sublists with offset d.

Partition[list,{n1,n2,…}]

partitions a nested list into blocks of size n1×n2×….

Partition[list,{n1,n2,…},{d1,d2,…}]

uses offset di at level i in list.

Partition[list,n,d,{kL,kR}]

specifies that the first element of list should appear at position kL in the first sublist, and the last element of list should appear at or after position kR in the last sublist. If additional elements are needed, Partition fills them in by treating list as cyclic.

Partition[list,n,d,{kL,kR},x]

pads if necessary by repeating the element x.

Partition[list,n,d,{kL,kR},{x1,x2,…}]

pads if necessary by cyclically repeating the elements xi.

Partition[list,n,d,{kL,kR},{}]

uses no padding, and so can yield sublists of different lengths.

Partition[list,nlist,dlist,{klistL,klistR},padlist]

specifies alignments and padding in a nested list.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Padding  
Padding Alignment  
Multidimensional Arrays  
Generalizations & Extensions  
Applications  
Properties & Relations  
See Also
Tech Notes
Related Guides
Related Links
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • Flatten
    • ArrayReshape
    • Multicolumn
    • TakeList
    • TakeDrop
    • RotateLeft
    • Split
    • SplitBy
    • Gather
    • GatherBy
    • BlockMap
    • Groupings
    • Take
    • PadLeft
    • ListConvolve
    • MovingAverage
    • CellularAutomaton
    • FindClusters
    • StringPartition
    • ImagePartition
  • Related Guides
    • Rearranging & Restructuring Lists
    • Constructing Matrices
    • Image Filtering & Neighborhood Processing
    • List Manipulation
    • Handling Arrays of Data
  • Tech Notes
    • Grouping and Combining Elements of Lists
    • Nested Lists
    • Partitioning and Padding Lists
    • See Also
      • Flatten
      • ArrayReshape
      • Multicolumn
      • TakeList
      • TakeDrop
      • RotateLeft
      • Split
      • SplitBy
      • Gather
      • GatherBy
      • BlockMap
      • Groupings
      • Take
      • PadLeft
      • ListConvolve
      • MovingAverage
      • CellularAutomaton
      • FindClusters
      • StringPartition
      • ImagePartition
    • Related Guides
      • Rearranging & Restructuring Lists
      • Constructing Matrices
      • Image Filtering & Neighborhood Processing
      • List Manipulation
      • Handling Arrays of Data
    • Tech Notes
      • Grouping and Combining Elements of Lists
      • Nested Lists
      • Partitioning and Padding Lists

Partition

Partition[list,n]

partitions list into nonoverlapping sublists of length n.

Partition[list,n,d]

generates sublists with offset d.

Partition[list,{n1,n2,…}]

partitions a nested list into blocks of size n1×n2×….

Partition[list,{n1,n2,…},{d1,d2,…}]

uses offset di at level i in list.

Partition[list,n,d,{kL,kR}]

specifies that the first element of list should appear at position kL in the first sublist, and the last element of list should appear at or after position kR in the last sublist. If additional elements are needed, Partition fills them in by treating list as cyclic.

Partition[list,n,d,{kL,kR},x]

pads if necessary by repeating the element x.

Partition[list,n,d,{kL,kR},{x1,x2,…}]

pads if necessary by cyclically repeating the elements xi.

Partition[list,n,d,{kL,kR},{}]

uses no padding, and so can yield sublists of different lengths.

Partition[list,nlist,dlist,{klistL,klistR},padlist]

specifies alignments and padding in a nested list.

Details

  • All the sublists generated by Partition[list,n,d] are of length n. Some elements at the end of list may therefore not appear in any sublist.
  • Partition[list,UpTo[n]] partitions into sublists of length up to n, allowing the final sublist to be shorter.
  • All elements of list appear in the sublists generated by Partition[list,n,1].
  • If d is greater than n in Partition[list,n,d], then elements in the middle of list are skipped. »
  • Sublist lengths can always be specified as UpTo[n], in which case shorter sublists can be returned if fewer than n elements are available.
  • Partition[list,n,d,{kL,kR}] effectively allows sublists that have overhangs that extend past the beginning or end of list.
  • Partition[list,n,d,k] is equivalent to Partition[list,n,d,{k,k}].
  • Common settings for {kL,kR} are:
  • {1,-1}allow no overhangs
    {1,1}allow maximal overhang at the end
    {-1,-1}allow maximal overhang at the beginning
    {-1,1}allow maximal overhangs at both beginning and end
  • Partition[list,n,d,{kL,kR},padlist] effectively lays down repeated copies of padlist, then superimposes one copy of list on them and partitions the result. »
  • Common settings for padlist are:
  • xpad with repetitions of a single element
    {x1,x2,…}pad with cyclic repetitions of a sequence of elements
    listpad by treating list as cyclic (default)
    {}no padding, potentially leaving sublists of different lengths
  • If list has length s, then Partition[list,n,d] yields Max[0,Floor[(s+d-n)/d]] sublists.
  • Partition[list,{n1,n2,…,nr}] effectively replaces blocks of elements at level r in list by depth-r nested lists of neighboring elements. »
  • If no offsets are specified, the neighborhoods are adjacent and nonoverlapping.
  • Partition[list,{n1,n2,…},d] uses offset d at every level.
  • Partition[list,nlist,dlist,{{kL 1,kL 2,…},{kR 1,kR 2,…}}] specifies that element {1,1,…} of list should appear at position {kL 1,kL 2,…} in the {1,1,…} block of the result, while element {-1,-1,…} of list should appear at or after position {kR 1,kR 2,…} in the {-1,-1,…} block of the result.
  • {kL,kR} is taken to be equivalent to {{kL,kL,…},{kR,kR,…}}.
  • {{k1,k2,…}} is taken to be equivalent to {{k1,k2,…},{k1,k2,…}}.
  • Partition[list,{n1,n2,…,nr},klist,padlist] effectively makes a depth-r array of copies of padlist, then superimposes list on them and partitions the result.
  • If list has dimensions {s1,s2,…,sr}, then Partition[list,{n1,n2,…,nr}] will have dimensions {q1,q2,…,qr,n1,n2,…,nr}, where qi is given by Floor[si/ni].
  • The object list need not have head List. »
  • Partition can be used on SparseArray objects.

Examples

open all close all

Basic Examples  (6)

Partition into sublists of length 2:

Partition into sublists of length 3 with offset 1:

Partition a two-dimensional array into 2×2 blocks with offset 1:

Allow the last list to be shorter than the others:

Partition cyclically:

Start with the first element at the end of the first partition:

Partition with padding on the left:

Use padding on the right:

Use padding on both ends:

Cyclic padding:

Scope  (18)

Padding  (7)

Incomplete sublists at the end are by default dropped:

Allow for a "ragged" partition, wherein last elements can be shorter:

Treat the list as cyclic:

Pad with x:

Pad by repeating {x,y,z} blocks:

Use no padding, so later sublists can be shorter:

Pad with Nothing to achieve the same result:

Partition from the end and use no padding:

Padding Alignment  (6)

Insert padding at the end:

Insert padding at the beginning:

Insert padding at both ends:

Insert no padding:

Make the input start at position 2 in the first sublist, and end at position 1 in the last sublist:

Pad by laying down repeating copies of {x,y}:

Multidimensional Arrays  (5)

Partition into 2×2 blocks:

Partition into 2×2 blocks with offset 1, padding at the ends of rows and columns with xx:

Partition into 2×2 blocks with offset 1, taking the array to be cyclic in both dimensions:

Insert padding at the beginnings of columns and the beginnings and ends of rows:

Pad the beginnings and ends of columns and the ends of rows:

Generalizations & Extensions  (4)

Skip elements by using an offset larger than the block size:

Padding can be longer than the block size:

The head need not be List:

Partition works with SparseArray objects:

Applications  (5)

Partition to lay out a list in 2D:

Find pairs of successive elements in a list:

Find successive ratios in a list:

Implement an elementary cellular automaton:

Partition a flat list of elements into a multidimensional array with specified dimensions:

Create a multidimensional array of successive integers:

Restructure a matrix:

Properties & Relations  (3)

Flatten is essentially the inverse of Partition:

The sublists in the result of Partition have the same length:

UpTo allows having a shorter list at the end:

TakeList allows specifying the lengths of the sublists:

ListCorrelate[ker,list] effectively combines ker with a partitioned list:

Partition the list into segments the length of ker with offset 1:

Use Dot to combine the kernel with each segment:

ListConvolve is similar except the kernel is reversed:

See Also

Flatten  ArrayReshape  Multicolumn  TakeList  TakeDrop  RotateLeft  Split  SplitBy  Gather  GatherBy  BlockMap  Groupings  Take  PadLeft  ListConvolve  MovingAverage  CellularAutomaton  FindClusters  StringPartition  ImagePartition

Function Repository: AssociationPartition  NearEqualPartition

Tech Notes

    ▪
  • Grouping and Combining Elements of Lists
  • ▪
  • Nested Lists
  • ▪
  • Partitioning and Padding Lists

Related Guides

    ▪
  • Rearranging & Restructuring Lists
  • ▪
  • Constructing Matrices
  • ▪
  • Image Filtering & Neighborhood Processing
  • ▪
  • List Manipulation
  • ▪
  • Handling Arrays of Data

Related Links

  • An Elementary Introduction to the Wolfram Language : Rearranging Lists
  • NKS|Online  (A New Kind of Science)

History

Introduced in 1988 (1.0) | Updated in 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2003 (5.0) ▪ 2014 (10.0) ▪ 2015 (10.3)

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2025_partition, organization={Wolfram Research}, title={Partition}, year={2015}, url={https://reference.wolfram.com/language/ref/Partition.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