TokenShrink is a privacy-first, local web application designed to convert PDFs and other documents into clean, structured Markdown.
When feeding large documents to AI models (like ChatGPT, Claude, or local LLMs), raw PDFs often waste context window limits and rack up high token costs. This tool extracts the content while preserving headings, lists, and structure—creating highly optimized, token-efficient plain text.
- AI-Optimized Output: Drastically reduces token usage while maintaining document context and structure.
- 100% Local & Private: No cloud uploads. All processing happens locally on your machine via a lightweight Python backend.
- Sleek UI: A modern, dark-themed interface built with Vanilla HTML/CSS/JS for maximum speed and simplicity.
- Built on MarkItDown: Leverages Microsoft's robust
markitdownlibrary for accurate document parsing.
- Python 3.8+ installed on your machine.
- Clone or Download this repository.
- Navigate to the backend directory:
cd backend - Create and Activate a Virtual Environment:
# Windows python -m venv venv .\venv\Scripts\activate # macOS/Linux python3 -m venv venv source venv/bin/activate
- Install Dependencies:
pip install -r requirements.txt
- Make sure your virtual environment is activated.
- Start the FastAPI backend server:
uvicorn main:app --port 8000
- Open the
frontend/index.htmlfile directly in your favorite web browser (no web server needed). - Drag and drop your file to convert!
This project is licensed under the MIT License - see the LICENSE file for details.
