{"uid":"cap_WiXwsFbk-MshOBguYPxIy","slug":"css-design-calc-css-unit-converter-f9d1770d","name":"CSS Design Calc – CSS Unit Converter","description":"Convert a CSS length between px, rem, em, pt, pc, in, cm, mm, Q, vw, vh, vmin, vmax and % with your root and viewport sizes.","url":"https://css-design-calc.x402tookit.com/css-unit-convert?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["value","from","to"],"properties":{"to":{"enum":["px","rem","em","pt","pc","in","cm","mm","q","vw","vh","vmin","vmax","%"],"type":"string","description":"Target unit (same choices)"},"from":{"enum":["px","rem","em","pt","pc","in","cm","mm","q","vw","vh","vmin","vmax","%"],"type":"string","description":"Source unit: px, rem, em, pt, pc, in, cm, mm, q, vw, vh, vmin, vmax or %"},"value":{"type":"number","description":"The number to convert"},"rootPx":{"type":"number","description":"Root font size in px for rem (default 16)"},"parentPx":{"type":"number","description":"Parent font size in px for em and % (default = rootPx)"},"viewportH":{"type":"number","description":"Viewport height in px for vh, vmin, vmax (default 900)"},"viewportW":{"type":"number","description":"Viewport width in px for vw, vmin, vmax (default 1440)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"css":{"type":["null","string"]},"asOf":{"type":["null","string"]},"input":{"type":["null","object"],"properties":{"unit":{"type":["null","string"]},"value":{"type":["null","number"]}}},"pixels":{"type":["null","number"]},"result":{"type":["null","number"]},"rootPx":{"type":["null","number"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"allUnits":{"type":["null","object"],"properties":{"%":{"type":["null","number"]},"q":{"type":["null","number"]},"cm":{"type":["null","number"]},"em":{"type":["null","number"]},"in":{"type":["null","number"]},"mm":{"type":["null","number"]},"pc":{"type":["null","number"]},"pt":{"type":["null","number"]},"px":{"type":["null","number"]},"vh":{"type":["null","number"]},"vw":{"type":["null","number"]},"rem":{"type":["null","number"]},"vmax":{"type":["null","number"]},"vmin":{"type":["null","number"]}}},"degraded":{"type":["boolean","null"]},"parentPx":{"type":["null","number"]},"viewportH":{"type":["null","number"]},"viewportW":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"resultUnit":{"type":["null","string"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_79KEAAYjjKPBGleEh1Dtr","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts a CSS length value from one unit to another (px, rem, em, pt, pc, in, cm, mm, Q, vw, vh, vmin, vmax, %) using configurable root and viewport sizes.","exampleAgentPrompt":"Convert 24px to rem — my root font size is 16px — and also show me what that is in em assuming a parent size of 20px.","exampleUseCases":[{"title":"Responsive layout unit conversion","prompt":"I'm building a responsive layout and need to know what 360px is in rem and vw — my root font size is 16px and the viewport is 1440px wide."},{"title":"Print stylesheet pt conversion","prompt":"Convert 18px to pt so I can use it in my print stylesheet — also tell me what that is in cm and mm."},{"title":"Fluid viewport unit from fixed design spec","prompt":"My design spec says a component should be 120px tall on a 900px viewport — what is that in vh, and what would it be in vmin if the viewport width is also 1440px?"}],"resultDescription":"Returns the converted value in the target unit, the equivalent pixel value, a formatted CSS string ready to paste, a breakdown of the input value expressed in every supported unit simultaneously, and a human-readable summary. Optional fields include rootPx used, reasons for any caveats, and a verdict.","failureModes":["Missing required query parameters (value, from, to) returns an error","Unsupported unit string returns a validation error","Converting viewport-relative units (vw, vh, vmin, vmax) without specifying viewportW or viewportH uses defaults (1440×900) which may not match the actual target device","Converting em or % without specifying parentPx uses rootPx as fallback, which may be inaccurate if parent differs from root","Non-numeric value input causes a parsing error"],"whenToPreferThis":"Use this endpoint when you need precise, multi-unit CSS length conversion with configurable root font size, parent font size, and viewport dimensions — especially when working on responsive or print stylesheets where default assumptions would give wrong results. Prefer this over manual calculation or a generic unit converter when you need the result expressed simultaneously in all CSS units, or when the target is a relative unit (rem, em, vw, vh, %) that depends on context.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:13:42.163Z","isFirstParty":false,"canonicalSlug":"css-design-calc-css-unit-converter-f9d1770d"}