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 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.

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.

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.

Time per round for 10, 100 and 500 elements Bars in milliseconds, one group per tool and variant, with one bar each for 10, 100 and 500 elements. Variant A comes first, then variant B. Inside a variant the groups are sorted by the time at 500 elements, the fastest first. Variant A: Position Calculator 0.080, 0.800 and 4.00, Floating UI 0.683, 6.77 and 33.1. Variant B: without any tool 0.020, 0.167 and 0.800, Position Calculator with all reads first 0.123, 1.17 and 5.40, Tether 0.463, 4.53 and 20.6, Floating UI with all reads first 0.737, 7.27 and 35.9, Position Calculator with a read and a write per item 0.163, 3.17 and 46.5, Floating UI with a read and a write per item 0.813, 9.63 and 83.8, Popper 1.43, 16.0 and 111.1. The table below the chart has the exact numbers. A, Position Calculator 10 0.080 ms 100 0.800 ms 500 4.00 ms A, Floating UI 10 0.683 ms 100 6.77 ms 500 33.1 ms B, no tool (targets move, one read) 10 0.020 ms 100 0.167 ms 500 0.800 ms B, Position Calculator, all reads first 10 0.123 ms 100 1.17 ms 500 5.40 ms B, Tether 10 0.463 ms 100 4.53 ms 500 20.6 ms B, Floating UI, all reads first 10 0.737 ms 100 7.27 ms 500 35.9 ms B, Position Calculator, read and write per item 10 0.163 ms 100 3.17 ms 500 46.5 ms B, Floating UI, read and write per item 10 0.813 ms 100 9.63 ms 500 83.8 ms B, Popper 10 1.43 ms 100 16.0 ms 500 111.1 ms
Median time of one round for 10, 100 and 500 elements, in milliseconds, on one linear scale. Variant A comes first, then variant B. Inside a variant the groups are sorted by the time at 500 elements, the fastest first. The bars for 10 elements are 1 to 4 px wide, so read the number.
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.

Bundle size, gzip Bars in kilobytes, gzip, sorted from the smallest to the largest. Position Calculator 2.7 as ES module and 2.9 as shipped, Popper 4.1 as popper-lite, Floating UI 4.3 with computePosition only and 6.7 with middleware, Tether 7.3, Popper 7.5 in full, Tippy 12.7. The table below the chart has the exact numbers. Position Calculator, ES module 2.7 kB Position Calculator, iife.min.js as shipped 2.9 kB Popper, popper-lite 4.1 kB Floating UI, computePosition only 4.3 kB Floating UI with middleware 6.7 kB Tether 7.3 kB Popper, full 7.5 kB Tippy (its CSS not counted) 12.7 kB
Size of the minified bundle after gzip, in kilobytes, the smallest first. A shorter bar is smaller.
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

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