{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"css-units"},"result":{"entity_type":"calculator","id":"css-units","calculator_id":"css-units","canonical_url":"https://tttkmbb.com/developer/css-units","name":"CSS Unit Converter","title":"CSS Unit Converter – px, rem, em, pt, pc, in, cm, mm and Q with Configurable Root Font Size","category":"developer","category_name":"Developer & IT","tool_name":"convert_css_units","featured_mcp_tool":false,"description":"Converts a CSS length between px, rem, em, pt, pc, in, cm, mm and Q using the CSS reference pixel (96 px per inch, 1 pt = 1/72 in) and the root and parent font sizes for rem and em, and lists the value in every unit.","use_when":"You are translating a design spec in points or millimetres to pixels, choosing rem values for a 16 px root font, or checking print stylesheet lengths.","do_not_use_when":"You need viewport-relative units (vw, vh, %), physical screen millimetres for a specific display (use screen-ppi) or paper dimensions (use paper-size).","inputs":[{"name":"value","label":"Value","type":"number","required":true,"min":-1000000000,"max":1000000000,"description":"The length to convert.","example":24},{"name":"from_unit","label":"From unit","type":"enum","required":true,"values":[{"value":"px","label":"Pixels (px)"},{"value":"rem","label":"Root em (rem)"},{"value":"em","label":"Em (em)"},{"value":"pt","label":"Points (pt)"},{"value":"pc","label":"Picas (pc)"},{"value":"in","label":"Inches (in)","aliases":["inch"]},{"value":"cm","label":"Centimetres (cm)"},{"value":"mm","label":"Millimetres (mm)"},{"value":"q","label":"Quarter-millimetres (Q)","aliases":["Q"]}],"description":"Unit of the given value.","example":"px"},{"name":"to_unit","label":"To unit","type":"enum","required":true,"values":[{"value":"px","label":"Pixels (px)"},{"value":"rem","label":"Root em (rem)"},{"value":"em","label":"Em (em)"},{"value":"pt","label":"Points (pt)"},{"value":"pc","label":"Picas (pc)"},{"value":"in","label":"Inches (in)","aliases":["inch"]},{"value":"cm","label":"Centimetres (cm)"},{"value":"mm","label":"Millimetres (mm)"},{"value":"q","label":"Quarter-millimetres (Q)","aliases":["Q"]}],"description":"Unit to convert to.","example":"rem"},{"name":"root_font_size_px","label":"Root font size","type":"number","unit":"px","required":false,"default":16,"max":1000,"exclusive_min":0,"description":"font-size of the html element, the basis of rem (browser default 16 px).","example":16},{"name":"parent_font_size_px","label":"Parent font size","type":"number","unit":"px","required":false,"default":16,"max":1000,"exclusive_min":0,"description":"Computed font-size of the element (or its parent for font-size itself), the basis of em.","example":16}],"outputs":[{"name":"result","label":"Result","type":"number","decimals":4,"description":"The value expressed in to_unit."},{"name":"px_value","label":"Value in px","type":"number","unit":"px","decimals":4,"description":"The value in CSS pixels, the common intermediate."},{"name":"conversion_table","label":"All units","type":"object","decimals":4,"description":"The value in px, rem, em, pt, pc, in, cm, mm and q."},{"name":"summary","label":"Summary","type":"string","decimals":4,"description":"Conversion as a sentence, e.g. 24px = 1.5rem."}],"input_schema":{"type":"object","properties":{"value":{"description":"The length to convert.","type":"number","minimum":-1000000000,"maximum":1000000000,"examples":[24]},"from_unit":{"description":"Unit of the given value.","type":"string","enum":["px","rem","em","pt","pc","in","cm","mm","q"],"examples":["px"]},"to_unit":{"description":"Unit to convert to.","type":"string","enum":["px","rem","em","pt","pc","in","cm","mm","q"],"examples":["rem"]},"root_font_size_px":{"description":"font-size of the html element, the basis of rem (browser default 16 px). Unit: px.","type":"number","maximum":1000,"exclusiveMinimum":0,"default":16,"examples":[16],"x-unit":"px"},"parent_font_size_px":{"description":"Computed font-size of the element (or its parent for font-size itself), the basis of em. Unit: px.","type":"number","maximum":1000,"exclusiveMinimum":0,"default":16,"examples":[16],"x-unit":"px"}},"additionalProperties":false,"required":["value","from_unit","to_unit"]},"output_schema":{"type":"object","properties":{"result":{"description":"The value expressed in to_unit.","type":"number"},"px_value":{"description":"The value in CSS pixels, the common intermediate. Unit: px.","type":"number","x-unit":"px"},"conversion_table":{"description":"The value in px, rem, em, pt, pc, in, cm, mm and q.","type":"object"},"summary":{"description":"Conversion as a sentence, e.g. 24px = 1.5rem.","type":"string"}}},"formula":"px = value × px_per_unit(from); result = px / px_per_unit(to); px per unit: 1 in = 96 px, 1 pt = 96/72 px, 1 pc = 16 px, 1 cm = 96/2.54 px, 1 mm = 96/25.4 px, 1 Q = 96/101.6 px, 1 rem = root_font_size_px, 1 em = parent_font_size_px","method":"Absolute units follow CSS Values and Units Level 4 (anchored to the 96 dpi reference pixel, so they only match physical size on print media); em and rem are resolved with the supplied font sizes.","sources":[{"name":"CSS Values and Units Module Level 4 – Absolute lengths (W3C)","url":"https://www.w3.org/TR/css-values-4/#absolute-lengths","type":"standard","retrieved_at":"2026-09-24"},{"name":"MDN Web Docs – CSS <length>","url":"https://developer.mozilla.org/en-US/docs/Web/CSS/length","type":"reference","retrieved_at":"2026-09-24"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"24 px to rem (16 px root)","inputs":{"value":24,"from_unit":"px","to_unit":"rem","root_font_size_px":16},"expected":{"result":1.5,"px_value":24,"conversion_table":{"px":24,"rem":1.5,"pt":18,"in":0.25,"mm":6.35,"pc":1.5},"summary":"24px = 1.5rem"},"url":"https://tttkmbb.com/api/v1/calculate/css-units?value=24&from_unit=px&to_unit=rem&root_font_size_px=16"},{"name":"12 pt to px","inputs":{"value":12,"from_unit":"pt","to_unit":"px"},"expected":{"result":16,"px_value":16,"conversion_table":{"rem":1,"cm":0.4233,"q":16.9333}},"url":"https://tttkmbb.com/api/v1/calculate/css-units?value=12&from_unit=pt&to_unit=px"}],"faq":[{"q":"Why is 1 in = 96 px when my screen is 220 dpi?","a":"CSS defines the px as a reference unit (1/96 in at arm's length) and browsers scale it with device pixel ratio; absolute CSS units are only physically accurate when printing."},{"q":"What is the difference between em and rem?","a":"rem is relative to the root (html) font-size, em to the current element's computed font-size, which compounds when nested; pass the relevant sizes in root_font_size_px and parent_font_size_px."},{"q":"What is a Q?","a":"A quarter-millimetre (1/4 mm), a unit used in Japanese typography; 1 Q = 0.945 px."}],"tags":["css units","px to rem","pt to px","em to px","css converter","rem calculator"],"related":[{"calculator_id":"screen-ppi","reason":"Physical pixel density of an actual display."},{"calculator_id":"length","reason":"General length conversion outside CSS."},{"calculator_id":"paper-size","reason":"Dimensions of paper formats for print stylesheets."}],"links":{"html":"https://tttkmbb.com/developer/css-units","markdown":"https://tttkmbb.com/developer/css-units.md","json":"https://tttkmbb.com/developer/css-units.json","api":"https://tttkmbb.com/api/v1/calculate/css-units","schema":"https://tttkmbb.com/api/v1/calculators/css-units","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-24"},"timestamp":"2026-09-24T03:44:08Z"}