# px to rem > How many rem is that many pixels? At the default 16 px font size, rem = px ÷ 16: 24 px is 1.5 rem. Convert px to rem at any root font size: rem = px ÷ font size, so at the default 16 px, 24 px is 1.5 rem. Change the font size if your root differs. A preset of [CSS unit converter](https://how.box/css-units/). - Page: https://how.box/px-to-rem/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/px-to-rem/?v={v}&from={from}&to={to}&fs={fs} - `v` (number 0 to 1e15): The CSS length to convert, in the from unit. Example: `1`. - `from` (px, rem, em, pt, pc, in, cm, mm or q): Unit of v (unit id: px, rem, em, pt, pc, in, cm, mm, q). Example: `rem`. - `to` (px, rem, em, pt, pc, in, cm, mm or q): Unit to convert to (unit id). Example: `px`. - `fs` (number 1 to 400): The font size in CSS px that 1 em and 1 rem stand for (1 to 400). Example: `16`. Example answer: https://how.box/px-to-rem/?v=1&from=rem&to=px&fs=16 A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `css_units_convert`: Converts a CSS length between units using exact definitions (1 in = 96 px = 2.54 cm, 1 pt = 1/72 in = 4/3 px, 1 pc = 16 px, 1 cm = 96/2.54 px, 1 mm = 1/10 cm, 1 Q = 1/40 cm; 1 rem and 1 em = the font size in px (context, default 16); W3C CSS Values and Units Level 4 §6). - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"css_units_convert","arguments":{"value":1,"from_unit":"rem","to_unit":"px","context":16}}}` - GET: https://how.box/mcp/run/css_units_convert?value=1&from_unit=rem&to_unit=px&context=16 ## How it works Designs usually arrive in pixels while a flexible stylesheet wants rem, so the same step comes up for every font size, margin and breakpoint. The rule is one division by the root font size: at 16 px, 24 px is 1.5 rem. Using rem instead of px lets text follow the size a reader chose in the browser settings. Spacing written in rem grows with the text and keeps the proportions of the layout. If your project sets the root size to something else, such as 62.5 % to make 1 rem equal 10 px, change the font size in the converter first. The table below is for the default root. A few more pairs at the default root: 12 px is 0.75 rem, 20 px is 1.25 rem and 32 px is 2 rem. If the root is set to 62.5 %, the root size is 10 px and 24 px becomes 2.4 rem instead of 1.5. Not every size should become rem. Hairline borders and shadows are often kept in px, because they should not grow with the text. Media queries written in rem or em follow the browser default size, not the size set on the html element. ## FAQ **What is 16px in rem?** 1 rem at the default root font size. 14 px is 0.875 rem and 18 px is 1.125 rem. **Does px to rem depend on the element's font size?** No. rem always follows the root element. Only em depends on the element it is used on. **Why does my rem value look wrong in my project?** Check the root font size in your stylesheet. If html has font-size: 62.5 %, one rem is 10 px, not 16. **Should I use rem or px for font sizes?** Use rem for text and the spacing around it, so it follows the reader's browser settings. Keep px for thin borders and details that should stay the same size. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)