ToolPal

px ↔ rem/em 转换器

将CSS像素值转换为rem和em单位,支持反向转换,包含常用换算参考表。

px
px
例如:24

常用换算值(基准 16px)

PXREM
8px0.5rem
12px0.75rem
14px0.875rem
16px1rem
18px1.125rem
20px1.25rem
24px1.5rem
32px2rem
48px3rem
64px4rem

使用方法

将CSS像素值转换为rem和em单位,支持反向转换,包含常用换算参考表。

  1. 1In the 'Settings' section at the top, verify or adjust the base font size (default 16px) to match your project's root font size set on the html element.
  2. 2To convert px to rem or em: click the 'PX → REM/EM' tab, type a pixel value in the input field, and both rem and em results appear instantly below.
  3. 3Each result card shows the conversion formula (e.g. 24px ÷ 16 = 1.5rem) — useful for understanding the math or pasting into code comments.
  4. 4To convert rem or em back to px: click the 'REM/EM → PX' tab, enter a rem or em value, and the pixel equivalent is shown.
  5. 5Use the 'Common Conversions' table at the bottom for quick reference — it lists 10 standard pixel values and their rem equivalents at base 16px.

主要功能

  • Bidirectional conversion — px to rem/em and rem/em back to px
  • Configurable base and parent font sizes — match your actual project settings
  • Live formula display — shows the exact math for each conversion
  • One-click copy for rem, em, and px results
  • Reference conversion table — 10 standard pixel values at base 16px for quick lookup

常见问题

了解更多