How to extract numbers from text
Paste text into Input text or select Upload for a .txt, .csv, .log, or .md file. Number Extractor places the values it keeps in Output text, then calculates Count, Sum, Average, Min, and Max. The options decide how decimals, minus signs, comma groups, repeated values, line breaks, and digits beside letters are handled.
- Enter text in Input text, or select Upload and choose a .txt, .csv, .log, or .md file.
- Set the extraction options below the text field.
- Read the values in Output text and the Count, Sum, Average, Min, and Max fields.
- Select Copy or Download to use the extracted list in another place.
Number Extractor options for decimals, negatives, and commas
The checked options apply as the page scans each candidate number. With the default settings, the amount and refund below remain, while the identifier is skipped:
Invoice: $1,250.00, refund: -15, code A123
1,250.00
-15
- Include decimals keeps values such as
3.14. When it is off, a decimal candidate is skipped as a whole. - Include negatives keeps a leading minus sign, as in
-45or-12.50. - Allow comma as thousands separator (6,500) accepts groups such as
1,250.00. Invalid comma groups are skipped. - Unique only keeps the first value when numbers are equal after commas are removed and numeric conversion is applied. Thus
4, 4.0, 4produces4. - One per line puts each result on its own line. Turn it off to join results with a comma and a space.
- Include embedded numbers keeps digits attached to letters. With it on,
A123contributes123; with it off, that candidate is ignored.
How Number Extractor reads text and calculates statistics
The scanner looks for digits with an optional minus sign, comma groups, and decimal part. By default, a number directly beside a letter, digit, or underscore is ignored. That keeps values such as A123, mp3, and h2o out of the numeric list.
Count, Sum, Average, Min, and Max use the values left after the options run. Commas are removed before calculation, so 1,250 contributes 1250. If no values remain, Count is 0 and the other fields show a hyphen. Copy and Download stay disabled until the extraction finds a value.
Where number extraction comes up
- Invoice review: paste charges, tax, and refunds, keep decimals and negatives, then check Sum and Average.
- Log cleanup: upload a
.logfile, leave Include embedded numbers off to skip IDs such asA123, and select Unique only when repeated values should appear once. - Report preparation: paste rows, keep One per line selected, then use Copy or Download to move the numeric list into another step.
When another text extractor fits better
Text Parsing & Data Extraction lists this numeric scan with tools for specific patterns. Use Currency Extractor for amounts marked with currency symbols or uppercase currency codes and line context. Use Extract Lines Containing a String for whole lines that match words or regular expressions. For a JavaScript pattern you define, choose Custom Regex Extractor.
The extraction script reads the entered value in the browser and updates the page fields. The page code shown here contains no fetch, XMLHttpRequest, sendBeacon, or form submission for the entered text.
Frequently asked questions
How do I extract numbers from text?
Enter text in Input text, set the extraction options, and read the matches in Output text. You can also select Upload for a .txt, .csv, .log, or .md file.
How do I extract decimals and negative numbers?
Leave Include decimals and Include negatives checked, then enter or upload the text. Values such as 3.14 and -12.50 remain available for Output text and the statistics.
Why are numbers in A123 or mp3 missing?
Numbers beside letters are skipped when Include embedded numbers is off. Turn that option on to extract the digit portion, such as 123 from A123.
Does Number Extractor calculate sum and average?
Yes. Count, Sum, Average, Min, and Max update from the values left after the extraction options are applied.