ForHosting KIT · Text & AI

Extract numbers from text

A sentence mentioning 12.5%, 1,234,567.89, 3 plants, 4200 units, a -1.5 margin and 2e3 spares gives back exactly those 6 numbers, in reading order and with repeats kept. Paste a report or lab note and copy the figures. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Extracting numbers from prose is a daily chore for analysts, students, journalists, and anyone who inherits a report as a paragraph instead of a spreadsheet. This extract-numbers-from-text tool scans your text from left to right and lists every integer and decimal it finds, including signed values, English thousands grouping, and scientific notation, in the order they appear. It is built for pulling quantities out of status updates, lab notes, invoices written as sentences, and changelog blurbs without opening a spreadsheet or writing a regular expression.

What counts as a number and how tokens are read in order

A number in running text is not the same object as a number in a spreadsheet cell. People write 42, 3.14, .75, +2, minus 1.5, 1,234.56, and 2e3 in the same sentence, and they also write ranges such as pages 10-20 and version strings such as v1.2.3 that look numeric but should not collapse into a single decimal. This extract-numbers-from-text capability walks the string once, left to right, and keeps every token that is an integer or a decimal under a fixed set of rules.

A leading plus or minus is a sign only at the start of the text or after whitespace or opening punctuation, so a change of -1.5 is signed while a page range 10-20 yields two unsigned integers. English thousands grouping is accepted when commas split groups of exactly three digits, so 1,234,567.89 is one value. A leading-dot decimal such as .75 is accepted.

Scientific exponents of the form e or E plus an optional sign and at least one digit are part of the same token. Multi-dot runs that look like software versions or IPv4 addresses are split into integer components so v1.2.3 becomes 1, 2, and 3 rather than 1.2 followed by .3. Order is always first-seen, including duplicates, because a report that repeats the same figure twice is saying something different from a unique-value dump.

Pull figures out of written reports

Analysts paste a quarterly paragraph and get every integer and decimal in order, including grouped thousands and percents stripped to their numeric token.

Lab notes and homework checks

Students and technicians extract measured values from running notes without retyping each reading into a spreadsheet by hand.

How do I extract numbers from text?

The response numbers array lists each integer and decimal in first-seen order, and values holds the same tokens as finite numbers.

Does it keep decimals such as 3.14 and .75?

Yes. Integers, ordinary decimals, leading-dot decimals, English thousands grouping, and scientific notation are all collected.

Is the extract numbers from text tool free?

The browser tool runs free on your device.

Will a page range such as 10-20 become a negative number?

No. A minus is a sign only at the start or after whitespace or opening punctuation, so 10-20 yields 10 and 20, while a change of -1.5 yields -1.5.

Why does a version like v1.2.3 give three separate numbers?

Because a run with several dots looks like a version or an address, not a decimal. It is split into its whole-number parts, so v1.2.3 gives 1, 2 and 3 instead of a misleading 1.2 followed by .3.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/str/extract-numbers

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/str/extract-numbers \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Quarterly report: revenue rose 12.5% to $1,234,567.89 after 3 plants shipped 4200 units at -1.5 margin and 2e3 spares."}'
{
  "text": "Quarterly report: revenue rose 12.5% to $1,234,567.89 after 3 plants shipped 4200 units at -1.5 margin and 2e3 spares."
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.extract_numbers",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_chars100000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Empty or missing text fails with invalid input so callers never store a silent empty payload.

What counts as a number and how tokens are read in order

Currency marks, percent signs, and unit words are boundaries, not part of the token: 12.5% and $42.00 contribute 12.5 and 42.00.

Input contract, response fields, and when the request is rejected

Finding no numbers is a valid success: numbers is an empty array and count is zero, which is the honest result for a paragraph that only has words. Use numbers alone when you want to paste the figures back into a document. Use values when a script will sum, sort, or compare them. Because the algorithm is pure string logic, continuous-integration tests can pin the full object. Source text follows the same retention rules as other KIT parse items. Send a JSON body with the required string field text set to the non-empty sample you want scanned. Aliases input, value, s, content, body, and string are accepted when older clients or form generators use those names. Missing text, a non-string value, a zero-length string, or a whitespace-only string all raise invalid_input with a message that names the problem, and those failures are not charged on the prepaid API. Length is capped at one hundred thousand characters so browser and Worker scans stay bounded; over-length input is also invalid_input. On success the response includes numbers as the ordered list of surface tokens so 1,234.50 and 007 stay readable, values as the same tokens parsed to finite IEEE numbers with grouping commas stripped, count as the shared length, integer_count for tokens that have no decimal point and no exponent, decimal_count for tokens that do, original echoing the exact input for UI tables, and method always extract_numbers so downstream code can branch without sniffing shapes. Keep payloads to ordinary document sizes rather than multi-megabyte dumps; this product is a text utility, not a bulk warehouse.

API usage, pricing, workflows, and what this tool is not

Call the free in-browser extract numbers from text tool for homework checks, invoice blurbs, lab notebooks, and quick audits without writing a regular expression in every language. A typical workflow pastes a quarterly paragraph, lists the figures, and copies values into a sheet. Do not expect this landing to classify which number is a price, a quantity, or a year—that is a different search intent served by structured extractors. Authors shipping SDKs can document text as the only required field, show a success example with mixed integers and decimals, and show an empty-string error example so integrators see both sides of the contract. Use the prepaid KIT API when a CMS, content pipeline, QA harness, tutoring app, or mobile client needs the same contract under balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with an amount extractor when the next step is currencies, taxes, and labelled totals, or with a date extractor when you need normalised calendar dates rather than the raw digits inside a date string.

CI fixtures for numeric parsers

Build scripts pin extracted numbers and parsed values so sign, thousands, and scientific-notation regressions fail continuous integration immediately.

What happens if text is empty?

The request fails with invalid_input. Empty or whitespace-only input is not allowed; validation failures are not charged on the prepaid API.

Read the full KIT documentation →