Extract numbers from text
Pulls every number out of a block of text, and can total them for you.
Paste any text and press the button. Every number is pulled out and listed, with a count and a sum underneath if you leave that option on.
The sum is the point
Most reasons for extracting numbers end in adding them up. An invoice pasted from a PDF, a chat thread where people quoted amounts, a report with figures scattered through prose — you want the total, and the tedious part is retyping the numbers into a calculator, which is also where the errors come from.
The count matters too. If you expected twelve figures and got fourteen, something in your text is being read as a number that should not be — usually a year, a page number or part of a product code. Better to see that immediately than to discover it in the total.
What counts as a number
With decimals and negatives on, which is the default, 1234, 12.5, -3 and
0,75 are all recognised, and both the full stop and the comma are accepted as a decimal mark since usage
differs by country. With the option off, only runs of digits are matched, so 12.5 comes out as two
separate numbers.
Turn it off deliberately when you are extracting things that are digit sequences rather than quantities: order numbers, phone digits, ID codes. For phone numbers specifically there is a tool that understands their shape, including country codes and separators.
Thousands separators are the known limitation. In 1,234.56 the comma is read as a decimal mark, giving
you two numbers rather than one. Remove the separators first — find and replace
with a rule of , => does it in one press — if your figures are formatted that way.
Uses
- Adding up an invoice or receipt copied out of a PDF or an email.
- Pulling figures out of a report to check them or chart them.
- Extracting IDs from log lines or a messy export.
- Checking a document for numbers that should not be public before you share it.
- Preparing data for a spreadsheet, with the comma-separated option pasting straight into a row.
Doing it without this tool
Excel: there is no simple function. The classic approach is an array formula built from MID,
ROW and INDIRECT that most people copy without understanding, and it extracts one number per
cell rather than all of them.
Word: Find & Replace with wildcards can find [0-9]{1,} and highlight the matches, but cannot
list them out.
Command line: grep -oE '[0-9]+(\.[0-9]+)?' file.txt, and pipe to
paste -sd+ - | bc for the sum.
Google Sheets: =REGEXEXTRACT(A1, "[0-9]+") for the first match only;
REGEXREPLACE stripping non-digits gives you all of them fused into one long number, which is a classic
trap.
Runs entirely in your browser. Your text is never uploaded — open DevTools, Network tab, and you will see zero requests while you use this tool.
How to use it
- Paste your text into the box.
- Leave "Include decimals and negatives" on unless you are extracting digit sequences such as ID codes.
- Press "Extract numbers".
- Read the count and sum at the bottom, and check the count matches what you expected.
Related tools
Frequently asked questions
Yes, with the default option on. Both the full stop and the comma are accepted as a decimal mark, since the convention differs by country.
That is the known limitation — the comma is read as a decimal mark and you get two numbers. Remove the separators first with find and replace, using a rule of ", =>" to delete them.
Yes. "Show count and sum" is on by default and prints both under the list, which saves retyping figures into a calculator.
Untick "Include decimals and negatives" and only runs of digits are matched. That is also the right setting for ID codes and reference numbers.
Yes, the "Remove numbers instead" button strips them and leaves the text.