JavaScript Trim end

trimEnd() removes whitespace from the end of a string only, leaving the start intact. It returns a new string.

Syntax

str.trimEnd()

Examples

Input Arguments Output
" hi " " hi"

Try it live

Type your input and see Trim end transform it instantly.

Trim end()

Type above to see the result…

Want to go further? Chain Trim end with other functions, pipe one output into the next and watch your data transform in the visual Playground.

Related functions

© 2026 Heifara Buval