不喜欢广告? 无广告 今天

Pixel / REM / EM Converter (CSS Units)

开发人员文本
广告 · 消除?

预设

设置

Used for EM calculation (EM is relative to the parent element font size)

Viewport Units

Viewport vw vh
360px (Mobile)
768px (Tablet)
1280px (Laptop)
1920px (Desktop)

Reference Table

像素 REM EM PT
8px
10px
12px
14px
16px
18px
20px
24px
32px
48px
64px
广告 · 消除?

指导

Pixel / REM / EM Converter (CSS Units)

Pixel / REM / EM Converter

Instantly convert between CSS units: pixels (px), root em (rem), and em. Adjust the base font size and watch all values update in real time. Perfect for front-end developers translating design specs into CSS.

如何使用

Enter a value in any of the three unit fields — px, rem, or em — and the other two update instantly. Adjust the base font size (default 16px) using the slider or input field to match your project's root font size. The reference table below shows common conversions at a glance.

特征

  • 双向转换 – Edit px, rem, or em and all others update instantly
  • Adjustable Base Font Size – Slider and input sync, default 16px
  • Reference Table – Common sizes auto-calculated for your base font size
  • Real-Time Updates – Throttled input for smooth performance
  • 仅客户端 – No data sent to any server

广告 · 消除?

常问问题

  1. What is the difference between rem and em in CSS?

    rem (root em) is relative to the root element font size (html), making it consistent across the entire page. em is relative to the font size of the parent element, which can compound in nested elements. rem is generally preferred for layout consistency.

  2. Why is 1rem equal to 16px by default?

    Browsers set a default root font size of 16px unless overridden. So 1rem = 16px, 0.5rem = 8px, 1.5rem = 24px. If you set html { font-size: 62.5%; }, then 1rem = 10px, making math easier.

  3. When should I use px instead of rem or em?

    Use px for values that should not scale with user font preferences, like borders, shadows, or media query breakpoints. Use rem for font sizes and spacing so your layout respects the user's accessibility settings. Use em for component-relative sizing.

  4. How does browser zoom affect CSS units?

    Browser zoom scales all CSS units proportionally, including px. This is different from OS-level text scaling. However, if a user changes their browser default font size, rem and em values adjust while px values do not — making rem/em better for accessibility.

想要享受无广告的体验吗? 立即无广告

安装我们的扩展

将 IO 工具添加到您最喜欢的浏览器,以便即时访问和更快地搜索

添加 Chrome 扩展程序 添加 边缘延伸 添加 Firefox 扩展 添加 Opera 扩展

记分板已到达!

记分板 是一种有趣的跟踪您游戏的方式,所有数据都存储在您的浏览器中。更多功能即将推出!

广告 · 消除?
广告 · 消除?
广告 · 消除?

新闻角 包含技术亮点

参与其中

帮助我们继续提供有价值的免费工具

给我买杯咖啡
广告 · 消除?