Numbers to Array Converter
Built for numeric data.
Convert the numbers
Numbers to Array Converter
// Your converted output will appear here.
Values stay unquoted, sorting is numeric rather than alphabetical, non-numeric entries can be filtered out, and a summary reports count, min, max, sum, mean and median.
How to use the Numbers to Array Converter
Paste the numbers
One per line, or switch the delimiter for a comma-separated row.
Filter and sort
Numeric values only drops anything that is not a number. Numeric sort orders by value, not by text.
Read the summary
Count, min, max, sum, mean and median update with the output, along with a count of anything skipped.
Numbers to Array Converter examples
Unquoted numeric JSON
Input
42 7 -13 1024 3.5
Output
[ 42, 7, -13, 1024, 3.5 ]
Sorted numerically, ascending
Input
42 7 -13 1024 3.5
Output
[ -13, 3.5, 7, 42, 1024 ]
Alphabetical sorting would put 1024 before 42, because it compares the first character of each.
Mixed input with the numeric filter on
Input
10 n/a 20 unknown 30
Output
[ 10, 20, 30 ]
Non-numeric rows are dropped and counted in the summary.
Working with numbers to array
Why alphabetical sorting ruins numbers
JavaScript's default Array.sort() converts everything to strings, so [42, 7, 1024] sorts to [1024, 42, 7]. Numeric sort here compares values, and the generated array is in the order shown. If you sort in your own code, pass a comparator rather than relying on the default.
What counts as a number
Integers, decimals, leading minus signs and scientific notation such as 1.2e-5 are all recognised. Thousands separators are not — 1,000 reads as two values under a comma delimiter, or as non-numeric under a newline one. Strip the separators before pasting.
Identifiers are not numbers
ZIP codes, phone numbers and account IDs look numeric but must stay strings: a leading zero disappears the moment the value is treated as a number, and a twenty-digit ID loses precision past the safe integer limit. For those, turn the numeric type off so the values stay quoted.
Popular text conversion tools
SQL IN Clause Generator
Turn a list of IDs or values into a SQL IN clause with correct apostrophe escaping, an optional WHERE and column name, NOT IN, and numeric detection.
Text to JSON Array Converter
Use this free online text to JSON array converter to turn lines, lists, TXT files, or delimited values into valid pretty-printed or minified JSON.
Line to Array Converter
Convert newline-separated text into an array. Handles CRLF and LF endings, blank lines and the trailing whitespace that copied columns and TXT files carry.
Python List Converter
Convert pasted text into a Python list, tuple or set with correct True, False and None literals, single or double quotes, and numeric type detection.
Numbers to Array Converter FAQs
Numbers to Array Converter
Built for numeric data. Values stay unquoted, sorting is numeric rather than alphabetical, non-numeric entries can be filtered out, and a summary reports count, min, max, sum, mean and median.