Extract Numbers

Extract numbers from text.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste text and press Run to list every number in it, one per line. Whole numbers, decimals and negatives are all picked up.

How to use

1
Step 1
Paste the text into Input.
2
Step 2
Press Run.
3
Step 3
Copy the numbers from Output.

How it works

A number is an optional minus sign, digits, and an optional decimal part. Commas are not treated as part of a number, so 1,200.50 is read as 1 and 200.50. Dates split too, and a hyphen before digits is read as a minus sign.

Worked example

Prices, a negative and a date

Input
Price 1,200.50 and -3.5 plus 42 items, 2024-05-01
Output
1 200.50 -3.5 42 2024 -05 -01
Walkthrough
The comma splits 1,200.50. The date 2024-05-01 splits into 2024, -05 and -01 because each hyphen reads as a minus sign.

Limitations

  • Thousands separators and dates are split into pieces.
  • Percent signs and currency symbols are not included in the numbers.
  • Numbers written as words are not found.

Questions

How do I pull numbers out of text?
Paste the text and press Run. Each number appears on its own line.
Why was 1,200 split into 1 and 200?
Commas are not treated as part of a number. Remove thousands commas first.
Does it find negative numbers?
Yes, a minus sign directly before digits is included.

Features

  • Integers, decimals, negatives
  • One per line
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • HTML Crash Course For Absolute Beginners

    Traversy Media

    Text on the web often starts as HTML you clean or count.

    Watch on YouTube
  • Learn JSON - Full Crash Course

    freeCodeCamp.org

    Structured text formats often sit next to plain-text tools.

    Watch on YouTube