How to Reverse a String in JavaScript

Reverse a string in JavaScript using split(), reverse(), and join(), plus a manual loop version and the pitfalls of each approach.

Published September 16, 2026

JavaScript strings don't have a built-in reverse() method, but you can reverse one by converting it to an array, reversing the array, and joining it back together.

const reversed = 'hello'.split('').reverse().join('')
// 'olleh'

Steps

  1. Call split('') to turn the string into an array of characters
  2. Call reverse() on that array to flip the order in place
  3. Call join('') to combine the characters back into a string

How it works

Strings in JavaScript are immutable, so you can't reverse one directly. Arrays are mutable and have a reverse() method, so the standard trick is to convert to an array, reverse it, then join it back into a string.

Things to watch for

  • split('').reverse().join('') breaks on multi-byte characters like emoji or combined accents — use [...str].reverse().join('') (spread operator) for correct Unicode handling
  • For very large strings in a hot loop, a manual for-loop building the result can be faster than the split/reverse/join chain

FAQ

Does JavaScript have a built-in String.reverse()?

No. Only arrays have reverse(); strings must be converted to an array first.

How do I reverse a string with emoji correctly?

Use the spread operator: [...str].reverse().join(''). It iterates by Unicode code point instead of by UTF-16 code unit, so multi-byte characters stay intact.

More JavaScript articles