Layout, measured.
No DOM, no guesstimates. Pure, blazing-fast JS text measurement for next-level UI.
How It Works
ShrinkWrap.js gives you precise text measurement without touching the DOM — in four simple principles.
#1 Zero DOM Dependency
ShrinkWrap.js never touches the DOM. All measurements happen in pure JavaScript, making it safe to use in any environment — server, worker, or browser.

#2 Blazingly Fast
Benchmarks show ShrinkWrap.js is 10–100x faster than DOM-based measurement. No layout reflow, no forced synchronous layouts, no jank.

#3 Universal Language Support
Full support for CJK characters, emoji, RTL scripts, and complex Unicode. ShrinkWrap.js handles every script your users write in.

#4 Render-Target Agnostic
Works with React, Vue, Svelte, Canvas, WebGL, React Native, and more. If you need text measurement, ShrinkWrap.js has you covered.

Benchmarks
In a suite of 10,000 measurements, ShrinkWrap.js completes in under 2ms — while DOM-based approaches take 200ms or more due to forced layout reflows.
View Full BenchmarksOpen-source, reproducible benchmarks.

Showcase
See what developers are building with ShrinkWrap.js — from rich text editors to data visualization tools.
Installation & Usage
Get up and running with ShrinkWrap.js in minutes. Install via npm and start measuring text with a single function call.

Why ShrinkWrap.js?
Everything you need for precise, performant text measurement — without the hacks.
No Layout Reflow
ShrinkWrap.js never triggers a browser layout reflow. Measure thousands of strings per frame without any performance penalty.
Handles CJK & Emoji
Full Unicode support including Chinese, Japanese, Korean characters and emoji. Your international users are first-class citizens.
No Guesstimates
Unlike character-width heuristics, ShrinkWrap.js uses the actual font metrics to return exact pixel dimensions every time.
Works Everywhere
Node.js, Deno, browser, Web Worker, React Native — ShrinkWrap.js runs wherever JavaScript runs, with zero platform-specific code.
Tiny Bundle Size
Under 3KB gzipped. ShrinkWrap.js won't bloat your bundle. Ship fast, measure faster.
Simple API
One function, clear options, predictable output. Integrate ShrinkWrap.js into any project in under five minutes.
Frequently Asked Questions
Everything you need to know about ShrinkWrap.js.
Stop hacking layout.
Spend your cycles building great UI, not fighting text measurement edge cases.




