Extract Integers from Data

Pull every integer out of free-form text - Smart mode handles thousand-separators and skips decimals. Free, offline, client-side, instant, secure.

Find every integer hiding in unstructured text - sales reports, log files, emails, receipts. Smart mode recognises thousand-separated numbers (1,2341234) and strips decimal tails ($45.9945). Strict mode preserves the original naive behaviour for opt-in compatibility.

- paste text to begin

How to Use Extract Integers from Data

  1. Paste your text. Anything - a report, a log line, an email, a paragraph. The output updates live as you type (200 ms debounce).
  2. Pick a mode. Smart (default) understands 1,234 as a single integer and discards the .99 tail of $45.99. Strict uses the old naive -?d+ regex - every run of digits is its own integer, comma and decimal interpretation is on you.
  3. Toggle the checkboxes. "Include negatives" (default on) recognises a minus sign only when it's NOT preceded by a digit or letter, so dates like 2024-01-15 don't accidentally produce -1 and -15. "Unique only" removes duplicates from the result.
  4. Pick the output shape. List with your choice of separator, comma-separated CSV, or JSON array. JSON downloads as .json, CSV as .csv, list as .txt.
  5. Read the stats line. Mode, count, unique count, range (min to max), and sum.
  6. Copy or download. Ctrl/Cmd + Enter copies. Download saves integers.txt / .csv / .json depending on format.

Frequently Asked Questions

What’s the difference between Smart and Strict modes?

Smart mode applies extra rules after the regex: thousand separators are stripped (1,234,5671234567), decimal tails are dropped (45.9945), and the minus sign is honored only when preceded by a non-word character. Strict mode is the original naive behaviour: every run of digits is one integer, decimals split into two integers, and any - in front of a digit run becomes a minus sign. Use Strict when you specifically want every digit cluster – Smart for everything else.

What gets extracted?

In Smart mode: thousand-separated integers (1,234,567), plain integers (42), and the integer portion of decimal numbers (45.9945). In Strict mode: every run of decimal digits, plus the optional preceding minus sign. Hexadecimal (0x1A), octal (0o17), binary (0b101), and scientific notation (1e5) are not parsed as numeric literals – they’re treated as digit runs (so 0x1A0 and 1 in either mode).

How are negative numbers detected?

Smart mode requires the minus sign to be preceded by a non-word character (whitespace, punctuation, or start of input). So Score: -5 extracts -5, but 2024-01-15 doesn’t extract -1 or -15 because the minus signs are preceded by digits. Strict mode treats every - in front of digits as a minus sign – useful if you actually want that, mostly a footgun otherwise.

What about very large numbers?

Internally each extracted integer is parsed with parseInt, which produces a Number. JavaScript’s safe integer range is ±253−1 (about ±9×1015) – values beyond that lose precision. The output preserves whatever parseInt returned, so most real-world inputs are fine, but a 30-digit integer in your text will be rounded.

How are duplicates handled?

If “Unique only” is on, duplicates are removed via a Set (order of first appearance preserved). The stats line shows both the total count and the unique count regardless of the toggle, so you can see how many duplicates exist in your input.

What output shapes are available?

Three: List (custom separator – newline, comma, or space), CSV (comma-and-space-separated as a single line), or JSON array ([1,2,3]). The stats line and download extension adapt to the choice. JSON downloads as .json, CSV as .csv, List as .txt.

How big an input can I paste?

The regex is O(n) and the post-processing is O(matches). A 10 MB text file finishes in well under a second. The 200 ms input debounce makes typing-while-editing smooth even on large pasted inputs. The fold-based min/max means no stack-overflow on very large arrays.

Is my data uploaded?

No. The page loads three static files (HTML, CSS, JS) and then runs entirely in your browser. Your input never leaves the device – no fetch, no XHR, no analytics, no cookies. You can disconnect from the internet after the page loads and the tool still works.

Is this tool free?

Yes – free, unlimited, no signup, no watermark. The extracted integers are yours to use anywhere. Attribution to is appreciated but not required.