🔢 Extract Numbers from Text
By ToolNimba Editorial Team · Updated 2026-06-19
Paste some text and press Extract numbers.
This tool pulls every number out of a block of text for you. Paste an invoice, a log, a report, or any messy paragraph, press Extract, and you get a clean list of just the numbers, with the count and the running sum worked out automatically. Choose a newline or comma separator, keep or strip negative signs, sort the values, then copy the result in one click. Everything runs in your browser, so the text you paste never leaves your device.
What is the Extract Numbers?
Extracting numbers from text means scanning a string and keeping only the numeric tokens: the integers (like 42), the decimals (like 3.14), and, if you want them, the negatives (like -7). Everything else, the words, punctuation, currency symbols and units, is discarded. The result is a tidy column or comma-separated list you can drop straight into a spreadsheet, a calculator, or your code.
Under the hood the tool uses a regular expression to find the numbers. A regular expression (regex) is a compact pattern that describes the shape of the text you are searching for. The pattern here looks for an optional minus sign, one or more digits, and an optional decimal point followed by more digits. That single pattern captures whole numbers and decimals in one pass, in the order they appear in your text, which is why a phrase like 'Order 12 items at 4.50 each' yields 12 and 4.50.
Because the matching is purely about the characters, it does not understand meaning. A date like 2026-06-19 is read as the three numbers 2026, 6 and 19, and a phone number or version string is broken into its digit groups too. That is usually what you want when scraping figures out of prose, but it is worth knowing so the count and sum match your expectation. If you only want positives, untick Keep negatives and any leading minus signs are stripped before the totals are worked out.
When to use it
- Pulling all the prices or amounts out of a pasted invoice or receipt to add them up quickly.
- Extracting measurements or quantities from a recipe, spec sheet, or product description.
- Scraping numeric values out of a log file or report so you can paste them into a spreadsheet.
- Grabbing scores, ages, or readings from a paragraph of notes without retyping each one.
How to use the Extract Numbers
- Paste or type the text that contains your numbers into the input box.
- Choose how to separate the output: one number per line, or comma separated.
- Optionally keep or strip negative signs, and tick Sort ascending to order the list.
- Press Extract numbers to see the list plus the count, sum, and average.
- Press Copy results to put the extracted list on your clipboard.
Formula & method
Worked examples
You paste the sentence: Buy 3 apples and 2 oranges for 4.50 dollars.
- The pattern scans left to right and matches each numeric token in order.
- It finds 3, then 2, then 4.50.
- count = 3 numbers
- sum = 3 + 2 + 4.50 = 9.5
- average = 9.5 / 3 = 3.166...
Result: List: 3, 2, 4.50 - Count 3, Sum 9.5, Average 3.1666666667
You paste a short ledger: Income 1200, refund -50, fee -12.99, bonus 300.
- With Keep negatives ticked, the minus signs are kept.
- Matched tokens: 1200, -50, -12.99, 300
- count = 4 numbers
- sum = 1200 + (-50) + (-12.99) + 300 = 1437.01
- average = 1437.01 / 4 = 359.2525
Result: List: 1200, -50, -12.99, 300 - Count 4, Sum 1437.01, Average 359.2525
What counts as a number, and what gets ignored
| Input fragment | Extracted as | Why |
|---|---|---|
| 42 | 42 | A plain integer is matched whole. |
| 3.14 | 3.14 | A decimal point with digits on both sides is kept. |
| -7 | -7 (or 7) | A leading minus is kept unless you strip negatives. |
| $1,250 | 1 then 250 | The comma is a separator, so it splits the number. |
| 2026-06-19 | 2026, 6, 19 | Each digit group is read as its own number. |
| fifty | (nothing) | Number words are not digits, so they are ignored. |
Common mistakes to avoid
- Expecting thousands separators to stay together. A figure written as 1,250 is read as two numbers, 1 and 250, because the comma breaks the digit run. Remove the commas first (or paste 1250) if you need it counted as one value.
- Forgetting that dates and codes are split. Strings like 2026-06-19, version 1.2.3, or a phone number are broken into their separate digit groups. The tool reads characters, not meaning, so these inflate your count.
- Leaving negatives in when you wanted magnitudes. If your sum looks lower than expected, a minus sign was probably kept. Untick Keep negatives to treat -50 as 50 before the count and sum are worked out.
- Missing number words. Words such as "twelve" or "half" are not numeric digits, so they are not extracted. This tool only finds figures written with digits.
Glossary
- Integer
- A whole number with no decimal part, such as 5, 0, or 42.
- Decimal
- A number with a fractional part written after a decimal point, such as 3.14 or 0.5.
- Regular expression
- A compact text pattern (regex) used to search for tokens that match a given shape, here, numbers.
- Token
- A single matched chunk of text. Each number the tool pulls out is one token.
- Sum
- The total you get by adding every extracted number together.
Frequently asked questions
How do I extract numbers from text?
Paste your text into the input box and press Extract numbers. The tool scans the text with a regular expression, pulls out every integer and decimal, and shows them as a list along with the count, sum, and average. You can then copy the list with one click.
Does it handle decimals and negative numbers?
Yes. Decimals such as 3.14 are matched whole, and negative numbers such as -7 are kept by default. If you only want positive magnitudes, untick Keep negatives and any leading minus sign is removed before the numbers are listed and summed.
Why is 1,250 split into 1 and 250?
The comma is treated as a separator between numbers, so a thousands separator breaks the digit run in two. To count 1,250 as a single value, remove the comma first or paste it as 1250.
Can it add up the numbers it finds?
Yes. As soon as you extract, the tool shows the total count, the sum of every number found, and the average (sum divided by count), so you do not need a separate calculator.
Is my text sent anywhere?
No. The extraction runs entirely in your browser using JavaScript. Nothing you paste is uploaded or stored, which makes the tool safe to use with private invoices, logs, or notes.
Can I get the numbers comma separated instead of one per line?
Yes. Choose the Comma option under Separate by and the output is joined with commas. Pick Newline to get one number per line, which is handy for pasting into a spreadsheet column.