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

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.

Try:
0Words
0Characters
0No spaces
0Sentences
0Paragraphs
0Lines
0Pages
0Reading
0Speaking

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

  1. Paste your text into the box.
  2. Leave "Include decimals and negatives" on unless you are extracting digit sequences such as ID codes.
  3. Press "Extract numbers".
  4. Read the count and sum at the bottom, and check the count matches what you expected.

Related tools

Extract betweenPulls out everything between a start and end marker — every occurrence, not…Extract URLsPulls every http and https link out of text or HTML and removes duplicates.Extract emailsPulls every email address out of a block of text and removes duplicates.Extract phone numbersFinds phone numbers in any text and lists them, one per line.Small capsSmall capital letters that paste anywhere plain text goes.Magic 8 ballAsk a yes or no question. The ball answers.Group generatorPaste names, choose how many groups, get evenly sized random teams.

See all text tools →

Frequently asked questions

Does it handle decimals and negative numbers?

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.

What about numbers with thousands separators like 1,234.56?

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.

Can it add the numbers up?

Yes. "Show count and sum" is on by default and prints both under the list, which saves retyping figures into a calculator.

How do I get only whole numbers?

Untick "Include decimals and negatives" and only runs of digits are matched. That is also the right setting for ID codes and reference numbers.

Can I remove the numbers instead of extracting them?

Yes, the "Remove numbers instead" button strips them and leaves the text.