String to Array

String to Array Converter

Convert a string to an array online by splitting text into clean values. Use spaces, commas, new lines, tabs, semicolons, or a custom delimiter to control how the string becomes an array.

The Tool

String to Array Converter

Paste text, choose your delimiter, and copy clean output. The sample below is preset for string to array.

String to Array Converter

Free, private, browser-based conversion for developers and data teams.

0 items / 0 unique
Input Text
0 characters Ctrl+Enter to convert - Drag and drop .txt
Split Input By
Cleaning Options
Output
Output Format
Customization
Output 0 unique
// Your converted output will appear here.
Paste text and click Convert Text, or use Ctrl+Enter.
Your text stays private. All conversion happens locally in your browser using JavaScript. Nothing is uploaded to any server.
How It Works

How to use the String to Array Converter

  1. 1. Add your text or list

    Paste it into the clearly labelled input box or load the example to see a working result.

  2. 2. Choose the input delimiter and output format

    Set the options that match the source data and the result you need.

  3. 3. Review and copy

    Check the preview and item count, then copy or download the output. Use Reset to start over.

Example

String to Array Converter examples

Use this pattern as a quick reference, then run your own list through the converter above.

Convert a string to a JavaScript array

Input

alpha beta gamma

Output

const words = [
  "alpha",
  "beta",
  "gamma"
];

Split a pipe-delimited string into JSON

Input

draft|review|published

Output

[
  "draft",
  "review",
  "published"
]
Formats

Supported input and output formats

Choose only the syntax your workflow needs; the preview updates locally in your browser.

  • JavaScript arrays
  • JSON arrays
  • Python lists
  • PHP arrays
  • SQL IN clauses
  • CSV, quoted, or custom-separated output
Guide

How to use this string to array tool

Split a string into array items

Use this page when your input starts as one plain string. Split by whitespace for words, commas for CSV-style values, new lines for copied lists, or a custom delimiter for structured text.

Choose output for code or data

Generate JavaScript arrays, JSON arrays, Python lists, PHP arrays, SQL IN clauses, CSV output, quoted lists, or custom-separated text from the same string.

Clean the string before copying

Trim extra spaces, remove empty values, deduplicate repeated words, sort alphabetically, or change case before generating the final array.

FAQ

String to Array Converter FAQs

Paste the string, choose how to split it, select an output format, and copy the generated array.
Yes. Use Space / Whitespace as the delimiter to split a sentence or word string into array items.
Yes. Set the delimiter to Comma, select JSON Array, and copy the generated JSON output.
Yes. Choose Custom Delimiter and enter the exact separator used inside your string.

Ready to use the String to Array Converter?

Paste your text, choose a format, and copy clean output. No signup, no upload, no waiting.

Convert Text Now Back to Main Tool