Converting a design from pixels to rem, one component at a time
Design files are drawn in pixels, but CSS that respects the reader is written in rem. The sums are simple division, and the real work is knowing which number to divide by. Take a card from a design file with a 24px title, 16px body text, 14px caption and 20px padding, on a site that keeps the browser default root size of 16px.
Each value is divided by 16. The title is 24 divided by 16, which is 1.5rem. The body text is 1rem. The caption is 14 divided by 16, which is 0.875rem. The padding is 20 divided by 16, which is 1.25rem. Type each pixel value into the box above, or read it from the table, and you have the whole card. If the design system sets html { font-size: 62.5% }, the root is 10px, and the same title becomes 2.4rem.
Now a reader opens the browser settings and sets the default font size to 20px. Every rem value grows by a quarter. The title becomes 30px, the body 20px and the padding 25px, so the card keeps its shape and is easier to read. Had the card been written in px, the text would have stayed at 16px and only page zoom could help. That is the practical reason to convert, and it is also why it is fine to leave a 1px border in px.
em is the unit to reach for when a value should follow the text it sits next to. An icon sized at 1em is always as tall as the letters beside it, whether it sits in a 14px caption or a 24px heading. The cost is compounding. Inside the 24px title, 0.5em of padding is 12px, not 8px. That is why this page has a separate box for the parent size: em is only predictable once you know what it is measured against.
The converter has limits. It does not read your stylesheet, so it cannot know the real root or parent size; it uses the numbers you type. It rounds to four decimal places, which is far below a visible difference. It does not convert percentages, viewport units or line heights; the Viewport Unit Calculator handles vw and vh. And a browser may still round a fractional pixel size when it draws text, so 0.8125rem and 13px can render identically.