Alternatives and comparison
Native CSS anchor positioning, Floating UI, Popper and Tether compared with Position Calculator, with a benchmark you can repeat.
Goal
Position Calculator gives you the values for position, collision and collision avoidance in JavaScript, for people who build their own styles and components. It does one thing and leaves the rest to you. This page helps you decide whether that fits your case, or whether native CSS anchor positioning or another tool does. The page states what each one does, with the source or the run behind each statement, and it shows a benchmark that you can repeat. Where a statement could not be checked, it says so.
Before you start
You know what a tooltip or popup needs: an item that sits next to a target and stays inside a boundary. If you have not used the library yet, see Getting started.
Choose
Choose native CSS when
The layout can be written with position-area and position-try-fallbacks, the
browsers in the status below are enough for your users, and nothing in your script
needs the position as a number. You write no JavaScript, and the browser keeps the placement up to date.
Choose Position Calculator when
You need the position, the collision and the way out of a collision as values: how far to move, how far the item is
from each edge of the boundary, which edges overflow and which placement was used. You apply them yourself, for
example as a transform, a tween, a class or a canvas drawing, and the library writes nothing in the
normal path. The result is synchronous. It is one function with no dependencies. The
examples show uses beyond a tooltip, and the
benchmark shows what a calculation costs.
Choose another tool when
You need scroll and resize updates done for you, clipping by scroll parents, a virtual element, right-to-left
placement or a ready-made tooltip. Floating UI computes like Position Calculator and has autoUpdate and
virtual elements. Popper and Tether apply the styles themselves. This page did not test how much code a tooltip
needs in each tool.
What native CSS can do
CSS anchor positioning places an element next to an anchor element without JavaScript. The browser does the placement and keeps it up to date on scroll and resize. This is a check in Chrome 157, Firefox 159 and WebKit 27.2 (Playwright, the same page in all three). The anchor is 80 x 30 px, the tooltip 100 x 40 px:
.anchor { anchor-name: --a; }
.tip {
position: absolute;
position-anchor: --a;
position-area: top;
position-try-fallbacks: flip-block;
}
- The tooltip sat above the anchor and centred on it (left -10 px, top -40 px relative to the anchor) in all three browsers.
-
With the anchor 10 px from the top edge of the containing block, the fallback
flip-blockmoved the tooltip below the anchor (left -10 px, top 30 px) in all three browsers. -
In a container with
dir="rtl",position-area: block-end span-inline-endgave left -20 px and top 30 px in all three browsers. The logical keywords follow the text direction. CSS.supports("position-area", "top")was true in all three.
The browser applies the result. A script gets no numbers from it: there is no value for how far the element moved, how far it is from an edge, or which edge it overflows. If the page must react to such values, native CSS is not enough. This follows from the CSS properties. You can check it in the MDN overview.
Browser status of native CSS
Read on 2026-11-17 from the Web Platform Status data
of the feature anchor-positioning. The state changes, so read it again before you decide.
- The whole feature is Baseline "limited". Its support list names Chrome 157 and Edge 157 (November 2026) and Safari 27 (September 2026). Firefox is not in the list for the whole feature.
-
The core groups (
anchor-namewithanchor(),position-visibility,position-try-fallbacks,position-area,anchor-scope) are Baseline "low" since 2026-01-13. They start in Chrome and Edge 125 to 131, in Firefox 147 and in Safari 26 (26.2 forposition-visibility). - Not read to the end: a further group of features that starts in Chrome 132. Check it if you use a feature that this page does not name.
Compare the tools
The facts about Floating UI, Popper and Tether come from their npm pages and documentation, read on 2026-11-11. They were not re-checked in a run, except where a row names the benchmark.
| Aspect | Position Calculator | Floating UI | Popper | Tether | Native CSS |
|---|---|---|---|---|---|
| Moves the element | No, returns moveBy |
No, returns coordinates | Yes | Yes | Yes |
| Size, gzip (details) | 2.7 kB | 4.3 kB (6.7 kB with middleware) | 4.1 kB (7.5 kB, full build) | 7.3 kB | none |
| Update on scroll and resize | You call calculate() |
autoUpdate |
Built in | Built in | Built in |
| Scroll parents | No, pass the boundary element | Yes | Yes | Yes | Built in |
| Event or virtual target | Mouse or pointer event, not touch events | Virtual element | Virtual element | Not checked | No |
| Right-to-left placement | No | Yes | Not checked | Not checked | Yes, logical keywords (run above) |
| Result as numbers | Yes: moveBy, distance, used placement |
Yes: coordinates and overflow values | No | No | No |
The benchmark
The benchmark lives in the folder bench/ of the
repository, with its own README.md that
lists the commands. The numbers below are the run stored in bench/reference/: Chrome 157.0.8103.78, run
on 2026-11-15, one machine with 12 threads, viewport 2300 x 2300 px. A timing depends on the machine, the load and
the browser version, so run the benchmark yourself before you quote a number.
The scene
Every element is an item of 80 x 30 px with its own target of 60 x 24 px. The targets sit in a grid. Every tool places the item at the bottom left of its target. After each run the script checks the result: the largest deviation from the wanted position is 0 px for every tool.
-
Position Calculator runs with
flip: "both"andstick: "all". No item overflows in this scene, so both options are on but idle. -
Floating UI runs with the
flipandshiftmiddleware, Popper with its defaults, Tether with a constraint to the window. - Variant A calculates only and writes nothing. Only Position Calculator and Floating UI can do that.
-
Variant B moves the targets by a few pixels, calculates all positions, writes them as a
transform, and reads the layout once. The row "without any tool" is only moving the targets and that one read, with no calculation and no write. It is the base cost that every B number includes.
Time per round
Median in milliseconds for one round, that is, one calculation for every element. Each point is 30 samples from three runs with a fresh page each. A shorter bar is faster. Position Calculator is purple.
All numbers of the time per round
| Variant and tool | 1 element | 10 | 100 | 500 |
|---|---|---|---|---|
| A, Position Calculator | 0.009 | 0.080 | 0.800 | 4.0 |
| A, Floating UI | 0.076 | 0.683 | 6.767 | 33.1 |
| B, without any tool (moving the targets and one read) | 0.004 | 0.020 | 0.167 | 0.8 |
| B, Position Calculator, all reads first | 0.017 | 0.123 | 1.167 | 5.4 |
| B, Tether | 0.057 | 0.463 | 4.533 | 20.6 |
| B, Floating UI, all reads first | 0.085 | 0.737 | 7.267 | 35.9 |
| B, Position Calculator, read and write per item | 0.016 | 0.163 | 3.167 | 46.5 |
| B, Floating UI, read and write per item | 0.084 | 0.813 | 9.633 | 83.8 |
| B, Popper | 0.146 | 1.433 | 16.033 | 111.1 |
One frame at 60 fps is about 16.7 ms. In this scene, 100 elements take 1.2 ms with Position Calculator in variant B, and 500 elements take 5.4 ms. Popper and Tether decide the order of reads and writes themselves.
The order of reads and writes
A read of a position after a write forces the browser to lay out the page again. The rows "all reads first" read the positions of all items and write afterwards. The rows "read and write per item" alternate. At 500 elements, the same library took 5.4 ms in the first order and 46.5 ms in the second. This is a fact about how the calling code is structured, not about the library. Calculate for all items first, then write the results.
A scene with overflow
In a second scene, every item has to flip or shift because its target sits near the right or bottom edge of the
window. At 100 elements, Position Calculator took 1.2 ms in variant B (0.833 ms in variant A) and Floating UI 10.5
ms (10.1 ms in A). Popper took 21.6 ms and Tether 4.5 ms. With flip: "none" and
stick: "none", Position Calculator left items 22 px outside the window, so in this scene flip and stick
are what keep them inside. Its time did not change compared with the scene without overflow.
Bundle size
Each tool was bundled from one entry file with esbuild (ES module, minified). The entry decides the result. 1 kB is
1000 bytes, rounded to 0.1 kB. The exact byte counts are in bench/reference/size.json.
Position Calculator appears twice. The first row is the ES module dist/position-calculator.js, bundled
and minified in the same way as the other tools, so the rows are comparable. The second row is the file
dist/position-calculator.iife.min.js as the package ships it, for use in a script tag. It is larger
because it also has a header comment and the lines that set the global variable.
All numbers of the bundle size
| Entry | Minified | gzip | brotli |
|---|---|---|---|
| Position Calculator, ES module | 7.5 kB | 2.7 kB | 2.5 kB |
Position Calculator, position-calculator.iife.min.js as shipped |
7.7 kB | 2.9 kB | 2.6 kB |
Popper, popper-lite |
10.9 kB | 4.1 kB | 3.7 kB |
Floating UI, computePosition only |
10.5 kB | 4.3 kB | 3.8 kB |
Floating UI with flip, shift, limitShift,
offset and
autoUpdate
|
16.6 kB | 6.7 kB | 6.0 kB |
| Tether | 22.2 kB | 7.3 kB | 6.6 kB |
| Popper, full | 20.1 kB | 7.5 kB | 6.7 kB |
| Tippy (its CSS not counted) | 35.9 kB | 12.7 kB | 11.5 kB |
What the numbers do not say
- One browser (headless Chrome) and one machine. No Firefox, no Safari, no mobile.
-
Two scenes with one target per item, no scroll above 0 and no scroll containers. Whether an item overflows
decides how much work
flipandshiftof Floating UI do. -
The other tools do more. Floating UI checks clipping ancestors and offers
autoUpdate. Popper and Tether listen to scroll and resize and know scroll parents. Position Calculator has none of that: you callcalculate()again. A time comparison does not compare equal work. Floating UI without middleware took 1.63 ms in variant A and 2.0 ms in variant B at 100 elements, so a large part of its gap to Position Calculator comes from the middleware. - Popper and Tether write the styles themselves, so only variant B compares them. Tippy is a complete UI on top of Popper and is only in the size table.
- No real application or game code. The call pattern of your code can change the numbers by a factor.
- The sizes depend on the entry and the bundler. Other entries give other numbers.
- The benchmark does not measure memory, start-up cost, touch devices or the quality of the placement.
Try it
Open the tooltip example and compare it with the native code above. The
result of calculate() shows the numbers that CSS does not give you. The library was run in Chrome 157.
Support in other browsers is not part of this page.
To repeat the benchmark, build the library in the project root of a clone and run it. The commands are in
bench/README.md:
npm run build
cd bench
npm ci
npm run bench -- 100
Next
- Limits lists what the library does not do, including right-to-left placement.
- Placement and collisions explains flip and stick, which the benchmark switches on.