CORE

Unit Converters

Convert between OOXML measurement units — TWIP, EMU, pixels, inches, points

OOXML uses multiple measurement systems. WordprocessingML uses TWIPs, DrawingML uses EMU (English Metric Units). These converters bridge the gap.

TWIP Conversions

TWIP = twentieth of a point. 1 inch = 1440 TWIPs.

import { convertMillimetersToTwip, convertInchesToTwip } from "@office-open/core";

convertMillimetersToTwip(25.4); // 1440 (1 inch)
convertInchesToTwip(1); // 1440
convertInchesToTwip(0.5); // 720

EMU Conversions

EMU = English Metric Unit. 1 inch = 914400 EMU. Used for images, shapes, and drawings.

Pixels ↔ EMU (96 DPI)

import { convertPixelsToEmu, convertEmuToPixels } from "@office-open/core";

convertPixelsToEmu(100); // 952500
convertEmuToPixels(952500); // 100

Inches ↔ EMU

import { convertInchesToEmu, convertEmuToInches } from "@office-open/core";

convertInchesToEmu(1); // 914400
convertEmuToInches(914400); // 1

Points ↔ EMU

import { convertPointsToEmu, convertEmuToPoints } from "@office-open/core";

convertPointsToEmu(12); // 152400
convertEmuToPoints(152400); // 12

Polymorphic Converters

These accept either a raw number (already in the target unit) or a UniversalMeasure string (mm/cm/in/pt/pc/pi, plus px at 96 DPI for EMU). Use them for fields where number is the native unit and strings provide ergonomic input — a number passes through unchanged.

import { convertToEmu, convertToTwip, convertToPt, convertToInch } from "@office-open/core";

convertToEmu("5cm"); // 1800000 (geometry fields: number = EMU)
convertToEmu(1800000); // 1800000
convertToTwip("1cm"); // 567 (Word spacing/indent)
convertToPt("1cm"); // 28.35 (xlsx row height)
convertToInch("1.3cm"); // 0.512 (xlsx page margins)

Conversion Table

FromToFunctionFormula
mmTWIPconvertMillimetersToTwipmm × 56.692913
inchesTWIPconvertInchesToTwipin × 1440
pixelsEMUconvertPixelsToEmupx × 9525
EMUpixelsconvertEmuToPixelsemu ÷ 9525
inchesEMUconvertInchesToEmuin × 914400
EMUinchesconvertEmuToInchesemu ÷ 914400
pointsEMUconvertPointsToEmupt × 12700
EMUpointsconvertEmuToPointsemu ÷ 12700

Common Unit Reference

UnitFull NameUsed In1 inch equals
TWIPTwentieth of a pointWordprocessingML1440
EMUEnglish Metric UnitDrawingML914400
ptPointTypography72
pxPixel (96 DPI)Screen layout96
mmMillimeterMetric25.4
Copyright © 2026