Docs · Trust boundary

Privacy architecture for confidential LLM inputs

The privacy architecture for counting confidential prompts, PDFs, DOCX files, code and images locally in the browser, with nothing uploaded for calculation.

TokenCalculator.dev is a privacy-first, browser-based token calculator. One hundred percent of the prompt text, readable document content, source code, data-file content, and image data submitted for a calculation remains in the active browser session. None of that content is uploaded to TokenCalculator.dev for counting.

Content boundarysubmitted content → browser memory → local extraction → Web Worker → result
Workflow mapBrowser-local trust boundary
01Your devicePrompt, files, images
02Browser memoryTemporary input state
03Local workersExtract and count
04Result viewTokens, cost, context
Calculation content stays on the device. Public assets, disclosed analytics, and pricing metadata use separate network paths without the submitted workload.

The precise privacy claim

Browser-local calculation means the sensitive payload follows an on-device execution path. It does not mean the public website is an air-gapped application. The page can make ordinary network requests for public assets, privacy-disclosed analytics, and current model-pricing metadata, but those requests do not contain prompts, extracted text, source code, images, token counts, or projected costs.

This narrower, testable claim is stronger than a vague “private” label: an enterprise reviewer can inspect the browser network panel and distinguish content processing from public metadata traffic.

Local execution path

  1. Text and source code: the browser reads pasted text or supported text-based files. OpenAI-family raw text is encoded with a local BPE vocabulary; supported proprietary families use the disclosed deterministic UTF-8 projection.
  2. PDF: PDF.js reads file bytes in the browser, uses a locally bundled worker, walks the document text layer, and returns extracted strings. Raster-only scanned PDFs are rejected because OCR is not performed.
  3. DOCX: the browser build of Mammoth reads the document package from an ArrayBuffer and extracts readable text locally.
  4. Images: the browser reads image dimensions and applies supported provider tile, patch, resize, detail, and cap rules. Image pixels are not sent to a vision model.
  5. Aggregation: a browser Web Worker combines text, extracted-file, and visual-token contributions, then applies context-window and model-pricing data.

Network boundary

The pricing layer may fetch the public Models.dev catalog to refresh model names, context limits, and prices. If that request is unavailable, the calculator uses its bundled registry. Google Analytics may receive standard page and session telemetry as described in the privacy policy. Neither channel receives calculation content or results.

TokenCalculator.dev also never forwards the submitted workload to OpenAI, Anthropic, Google, DeepSeek, or another inference provider. A later API request made by the user in a different product is outside this calculator's trust boundary.

Data lifecycle

  • Submitted content and derived counts are held in the current page and worker memory.
  • Calculator content is not written to an application database or server log.
  • Reloading or closing the page discards the active calculation state.
  • Local storage is used for interface preferences such as theme—not prompt or file content.
  • The per-file input limit is 12 MB.

Enterprise and confidential-input use

The architecture is useful when a team needs a preflight count for unreleased source code, internal system prompts, contracts, reports, logs, datasets, security procedures, or other company material that should not be sent to a third-party counting endpoint. It reduces one disclosure path; it does not replace an organization's data-classification rules, endpoint controls, browser policy, legal review, or approved AI-provider agreement.

For high-assurance evaluation, use a managed browser, inspect the network requests, review the open implementation, and compare the local result with approved provider usage metadata using a non-sensitive test fixture.