How to Reverse a String in Python

Reverse a string in Python using slicing [::-1], the reversed() built-in, or a loop, with notes on performance and readability.

Published September 17, 2026

Python strings have no reverse() method, but slicing with a step of -1 reverses any string in one expression: text[::-1]. This guide covers that, reversed() with join, and reversing word order.

The concept

Strings are immutable sequences, so reversing always creates a new string. Slicing syntax is [start:stop:step]; leaving start and stop empty and using step -1 walks the string from the end to the beginning.

reversed(text) returns an iterator over the characters backwards; ''.join(...) glues them into a string.

Slicing in action

s = 'hello'
s[::-1]
'olleh'
''.join(reversed(s))
'olleh'
' '.join('one two three'.split()[::-1])
'three two one'

Practical examples

Slicing

def reverse(s):
    return s[::-1]

reverse('Python')  # 'nohtyP'

reversed + join

''.join(reversed('Python'))

Palindrome check

A common use: a string equals its own reverse.

def is_palindrome(s):
    s = s.lower()
    return s == s[::-1]

is_palindrome('Level')  # True

Common mistakes

  • Calling s.reverse() — that exists on lists, not strings.
  • Using str(reversed(s)), which returns '<reversed object ...>' instead of the text.
  • Reversing words when you meant characters; split first, then reverse the list.

Key takeaways

  • s[::-1] is the idiomatic answer.
  • reversed() needs ''.join to become a string.
  • Strings are immutable; you get a new one.

FAQ

Is slicing fast?

Yes, it runs in C and is the fastest common approach.

Does it handle Unicode?

It reverses code points; combining accents may separate from their base letters.

More Python articles