A production-ready, 100% client-side web application for compressing and optimizing LLM prompts using TOON encoding. Reduce token usage by 30-60% while preserving your prompt's core intent - all processing happens in your browser, your data never leaves your device.
- TOON Encoding: Advanced compression using TOON format to reduce token usage by 30-60%
- Multiple Strategies: Choose from Gentle, Balanced, or Aggressive compression modes
- Real-time Token Counting: Live token counting before and after optimization
- 100% Private: All processing happens in your browser - no data ever leaves your device
- Privacy-First: No API calls, no backend, no data collection
- Responsive Design: Mobile-first, works on all devices
- Beautiful UI: Modern dark theme with gradient accents
- Node.js 18+
- npm or yarn
# Install dependencies
npm install
# Start development server
npm run devOpen http://localhost:3000 in your browser.
npm run build
npm startapp/
├── prompt-optimizer/
│ ├── page.tsx # Main optimizer UI
│ ├── layout.tsx # Shared layout with nav/footer
│ └── loading.tsx # Skeleton loader
components/
├── prompt-optimizer/
│ ├── PromptInput.tsx
│ ├── OptimizedOutput.tsx
│ ├── TokenCounter.tsx
│ ├── OptimizationControls.tsx
│ └── CopyButton.tsx
lib/
├── prompt-optimizer/
│ ├── tokenUtils.ts # js-tiktoken wrappers
│ ├── compressionStrategies.ts # Rule-based + smart compression
│ └── types.ts # TypeScript interfaces
utils/
├── clipboard.ts # Safe copy-to-clipboard
└── localStorage.ts # User preferences
- Visit the Live Website
- Paste your LLM prompt in the input area
- Select compression strategy:
- Gentle: Light compression, preserves most meaning (~20-30% reduction)
- Balanced: Moderate compression, good balance (~40-50% reduction)
- Aggressive: Maximum compression, significant reduction (~70-80% reduction)
- TOON: Encode using TOON format for maximum efficiency
- Click "Optimize Prompt"
- View the token savings and copy the optimized result
- Token Counting: Uses
js-tiktokenwith GPT-4o encoding - Compression: Rule-based heuristics with smart truncation
- Framework: Next.js 14 with App Router, TypeScript, Tailwind CSS
- Browser Support: Chrome, Firefox, Safari, Edge (modern versions)
MIT