files/en-us/web/api/cssnumericvalue/to/index.md
{{APIRef("CSS Typed OM")}}
The to() method of the {{domxref("CSSNumericValue")}} interface converts a numeric value from one unit to another.
to(unit)
unit
A {{domxref('CSSUnitValue')}}.
SyntaxError {{domxref("DOMException")}}
CSSNumericValue on which the method is being called can't be resolved to a single value and type.
This might occur if the value is calculated from a variable when the value of that variable can't be known in the context.// Prints "0.608542cm"
console.log(CSS.px("23").to("cm").toString());
{{Specifications}}
{{Compat}}