Skip to tool

SQL Split lines Online

Split text into lines with optional line endings.

The output updates as you type. The tool processes input in your browser.

Worked example

Keep line endings to inspect the separators as well as the text. One final line ending does not create an additional empty entry. Use PostgreSQL’s function reference to adapt the input to SQL syntax.

Keep line endings
false
Sample input
line1
line2
line3
Sample output
[
  "line1",
  "line2",
  "line3"
]

Using this operation in SQL

The interactive result uses JavaScript. Check the database dialect. PostgreSQL text functions use SQL-style one-based positions and LIKE uses its own pattern syntax.

SQL reference