Reverse an Array in Python – 10 Examples

Reversing an array is one of the most fundamental operations in Python, yet Python does not have a single array type — it has lists, the array module, and NumPy. Each behaves differently when reversed. This guide covers every method with up-to-date examples so you can pick the right tool for your situation. TLDR: Use list slicing [::-1] for a quick reversed copy of a Python list. Use arr.reverse() for in-place reversal of a list. For NumPy arrays, prefer np.flip() or arr[::-1] — both are fast and return new arrays. The array module also supports .reverse() but only works on 1D data.

Reverse a List in Python

Lists are Python’s default sequence type. They support both in-place and copy-based reversal.

1. List Slicing

Slicing with a step of -1 creates a reversed copy without modifying the original.
arr = [11, 22, 33, 44, 55]
print("Original:", arr)

reversed_arr = arr[::-1]
print("Reversed:", reversed_arr)
print("Original unchanged:", arr)

Output:
Original: [11, 22, 33, 44, 55]
Reversed: [55, 44, 33, 22, 11]
Original unchanged: [11, 22, 33, 44, 55]

This is the most Pythonic one-liner. It works on any sequence (list, tuple, string).

2. The list.reverse() Method

The reverse() method reverses the list in place. It modifies the original and returns None.
arr = [11, 22, 33, 44, 55]
arr.reverse()
print("Reversed in place:", arr)

Output:
Reversed in place: [55, 44, 33, 22, 11]

Important: This mutates the original list. Use it when you don’t need the original order.

3. The reversed() Built-in Function

reversed() returns an iterator that yields items in reverse order. Wrap it with list() to get a new list.
arr = [12, 34, 56, 78]
result = list(reversed(arr))
print("Reversed:", result)
print("Original:", arr)

Output:
Reversed: [78, 56, 34, 12]
Original: [12, 34, 56, 78]

This is memory-efficient for large lists since it doesn’t create a full copy upfront.

Reverse a Python array Module

The array module provides fixed-type arrays (‘i’ for integers, ‘f’ for floats). Unlike NumPy, it’s part of the standard library with no extra install.

1. The array.reverse() Method

The array module’s reverse() works the same way as list’s — in place, no return value.
import array

arr = array.array(‘i’, [2, 4, 6, 8, 10, 12])
print("Before:", arr)

arr.reverse()
print("After:", arr)

Output:
Before: array(‘i’, [2, 4, 6, 8, 10, 12])
After: array(‘i’, [12, 10, 8, 6, 4, 2])

2. The reversed() Built-in

You can also use reversed() with an array, then reconstruct an array from it.
import array

arr = array.array(‘i’, [10, 20, 30, 40])
reversed_arr = array.array(‘i’, reversed(arr))
print("Original:", arr)
print("Reversed:", reversed_arr)

Output:
Original: array(‘i’, [10, 20, 30, 40])
Reversed: array(‘i’, [40, 30, 20, 10])

Reverse a NumPy Array in Python

NumPy arrays are the go-to choice for numerical computing in Python. They support fast vectorized reversal along one or all axes.

1. Using np.flip()

np.flip() reverses along all axes by default and returns a new array.
import numpy as np

arr = np.array([‘A’, ‘s’, ‘k’, ‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’])
print("Original:", arr)

reversed_arr = np.flip(arr)
print("Reversed:", reversed_arr)

Output:
Original: [‘A’ ‘s’ ‘k’ ‘P’ ‘y’ ‘t’ ‘h’ ‘o’ ‘n’]
Reversed: [‘n’ ‘o’ ‘h’ ‘t’ ‘y’ ‘P’ ‘k’ ‘s’ ‘A’]

2. Using np.flipud()

np.flipud() flips the array vertically (up-down). For a 1D array this behaves identically to np.flip(), but for 2D arrays it only reverses rows.
import numpy as np

arr = np.array([‘A’, ‘s’, ‘k’, ‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’])
print("Original:", arr)
print("Flipped up-down:", np.flipud(arr))

Output:
Original: [‘A’ ‘s’ ‘k’ ‘P’ ‘y’ ‘t’ ‘h’ ‘o’ ‘n’]
Flipped up-down: [‘n’ ‘o’ ‘h’ ‘t’ ‘y’ ‘P’ ‘k’ ‘s’ ‘A’]

3. Slicing with [::-1]

NumPy supports the same slice notation as Python lists.
import numpy as np

arr = np.array([1, 3, 5, 7, 9])
print("Original:", arr)
print("Reversed:", arr[::-1])

Output:
Original: [1 3 5 7 9]
Reversed: [9 7 5 3 1]

Slicing returns a view when possible (no copy is made), making it both fast and memory-efficient.

Reversing Multi-Dimensional Arrays

Reversing 2D arrays requires specifying which axis to reverse.
import numpy as np

arr_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print("Original 2D array:")
print(arr_2d)

# Reverse both rows and columns (complete flip)
both = arr_2d[::-1, ::-1]
print("
Reversed both axes:")
print(both)

# Reverse rows only (flip up-down)
up_down = np.flipud(arr_2d)
print("
Flip up-down:")
print(up_down)

# Reverse columns only (flip left-right)
left_right = np.fliplr(arr_2d)
print("
Flip left-right:")
print(left_right)

Output:
Original 2D array:
[[1 2 3]
 [4 5 6]
 [7 8 9]]

Reversed both axes:
[[9 8 7]
 [6 5 4]
 [3 2 1]]

Flip up-down:
[[7 8 9]
 [4 5 6]
 [1 2 3]]

Flip left-right:
[[3 2 1]
 [6 5 4]
 [9 8 7]]

For a pure Python nested list, you need nested comprehension to reverse both dimensions:
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
reversed_matrix = [row[::-1] for row in matrix[::-1]]
print("Reversed nested list:", reversed_matrix)

Quick Comparison of All Methods

Method Type In-Place? Returns Works on
list[::-1] Slicing No (copy) New list List, tuple, string
list.reverse() Method Yes None List, array
reversed(list) Built-in No Iterator Any iterable
np.flip(arr) NumPy No New array NumPy array
np.flipud(arr) NumPy No New array NumPy array
arr[::-1] Slicing No View/copy List, NumPy array

Frequently Asked Questions

What is the fastest way to reverse an array in Python? For NumPy arrays, np.flip() and slicing [::-1] are the fastest — they use optimized C code under the hood. For plain Python lists, slicing [::-1] is the most Pythonic and also the quickest in most cases. If you need in-place reversal and want to save memory, use list.reverse().
What is the difference between reverse() and reversed() in Python? list.reverse() is a method that reverses the list in place and returns None. reversed() is a built-in function that returns an iterator yielding items in reverse order without modifying the original. Use reverse() when you don’t need the original, and reversed() when you want to preserve it.
Can I reverse a NumPy array without NumPy? Yes. For a Python list you can use slicing (arr[::-1]) or list.reverse(). The array module also supports the reverse() method. However, if you are working with large numerical datasets, NumPy is significantly faster and the standard choice in scientific Python.
Does reversing an array create a copy? It depends on the method. Slicing ([::-1]) and np.flip() return new objects. list.reverse() modifies in place and returns no copy. With NumPy slicing arr[::-1] on a view (when possible), no full copy is made, saving memory.
How do I reverse a 2D array in Python? With NumPy, use np.flipud() to reverse rows or np.fliplr() to reverse columns. Use arr[::-1, ::-1] to reverse both axes at once. With a pure Python nested list, use a list comprehension: [row[::-1] for row in matrix[::-1]].

Conclusion

Python gives you multiple ways to reverse arrays, and the right choice depends on your data type and whether you need to preserve the original. For quick in-place reversal of a list, use list.reverse(). For a reversed copy without touching the original, slicing [::-1] is clean and idiomatic. For numerical work with NumPy, np.flip() and slicing are both fast and return new arrays. Understanding these options lets you write cleaner, more efficient Python code regardless of which array type you are working with. Internal Links: initializing a Python array, adding elements to a Python array, Python array examples, multidimensional arrays in Python, printing an array in Python, NumPy arange method, appending to a list in Python, NumPy linspace
Ninad
Ninad

A Python and PHP developer turned writer out of passion. Over the last 6+ years, he has written for brands including DigitalOcean, DreamHost, Hostinger, and many others. When not working, you'll find him tinkering with open-source projects, vibe coding, or on a mountain trail, completely disconnected from tech.

Articles: 131