How to reverse a string in Python
· 1 min read · Updated March 16, 2026 · beginner
python strings slicing
The simplest way uses slicing with a negative step:
text = "hello"
reversed_text = text[::-1]
print(reversed_text) # olleh
One line, no imports needed.
Using reversed() with join()
text = "hello"
reversed_text = "".join(reversed(text))
print(reversed_text) # olleh
This approach is useful when you need to process each character individually before joining them back together.
Common mistake
Don’t forget to rejoin the characters:
reversed(text) # Returns <reversed object>, not a string
# Correct: "".join(reversed(text))