JavaScript Split

split() breaks a string into an ordered array of substrings, cutting at every occurrence of the separator you pass. It is one of the most-used string methods in JavaScript and the natural first link in a data pipeline: split, then map, then join.

Syntax

str.split(separator)

Examples

Input Arguments Output
"a,b,c" "," ["a","b","c"]
↳ Split a CSV row into fields.
"hello world" " " ["hello","world"]
↳ Split a sentence into words.
"abc" "" ["a","b","c"]
↳ Empty separator splits every character.

When to use it

  • Parse CSV / delimited data into arrays.
  • Tokenise a sentence into words for counting or filtering.
  • Turn a string into characters to reverse or shuffle it.

Gotchas

  • Passing no separator returns the whole string in a single-element array: ["a,b,c"].
  • A regex separator is allowed and powerful: str.split(/\s+/) splits on any run of whitespace.

Try it live

Type your input and see Split transform it instantly.

Split()

Type above to see the result…

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

Related functions

© 2026 Heifara Buval