px ↔ rem 轉換器
開發者工具依根字體大小轉換,附常用比例對照表
答案速覽
px ↔ rem Converter: Root font-size based conversion with common scale table. rem = px ÷ root font-size (browser default 16px).
px
px
rem
24px = 1.5rem · 1.5rem = 24px
1 rem16 px
24 px1.5 rem
1.5 rem24 px
62.5% trick10px = 1rem
換算步驟
- 1rem = px ÷ root font-size. 24px ÷ 16 = 1.5000 rem.
- 2px = rem × root font-size. 1.5rem × 16 = 24.00 px.
- 3html { font-size: 62.5% } 將根字號設為 10px,此時 1.6rem=16px,心算零成本(但會覆蓋使用者瀏覽器字號設定,需權衡)。
常用梯度(點擊填充)
| px | rem | 用途 |
|---|---|---|
| 12px | 0.75rem | Caption text |
| 14px | 0.875rem | Small body |
| 16px | 1rem | Default body (browser base) |
| 18px | 1.125rem | Large body |
| 20px | 1.25rem | Small heading |
| 24px | 1.5rem | H3 heading |
| 32px | 2rem | H2 heading |
| 48px | 3rem | H1 display |
rem 尊重使用者瀏覽器字號設定(可存取性友好),px 不尊重。字號與佈局間距用 rem,邊框(1px 髮絲線)與陰影用 px。em 相對父元素字號——巢狀時會層層放大/縮小,慎用。
這個工具對你有幫助嗎?
怎麼用
- Paste or type content: drop code/text into the px ↔ rem Converter or fill the parameters.
- Choose mode/options: switch format, rules or processing as needed.
- Live output: results appear instantly — nothing is submitted, data stays in your browser.
- One-click copy: copy the output straight into your development environment.
核心要點
- px ↔ rem Converter is a free online developer tool — open and use, no sign-up.
- All calculations run locally in your browser; your data never leaves the device.
- Key capability: Root font-size based conversion with common scale table.
- Results come with formulas and reference tables so you can verify every number.
原理與公式
px ↔ rem conversion
rem = px ÷ root font-size (browser default 16px)
em is relative to the parent (compounds); rem is always root-relative
vw = px ÷ viewport width × 100
Trick: set html font-size to 62.5% so 1rem = 10px
Example: 24px at 16px root = 1.5rem; 24px on a 1440px viewport ≈ 1.667vw.
常見問題
How do I use the px ↔ rem Converter?
Open the page and fill in the input fields — results update automatically. Root font-size based conversion with common scale table.
Are the results accurate?
Yes. Standard formulas and conversion factors are used and verified.
Is it free? Do I need to sign up?
Completely free. No registration, login or download required.
Does it work on mobile?
Yes. The responsive design works on phones, tablets and desktops.
Is my data saved?
No. Everything runs locally in your browser.
相關工具
相關指南
來源與更新
Based on RFC 4648, ECMA-262 and related specifications. Last updated: 2025-07
最近更新:
本頁公式與內容經YiJianSuan團隊覆核,僅供學習參考,實際業務請以官方口徑為準。
內容由YiJianSuan編輯團隊維護並定期覆核,更新與審核流程詳見編輯規範.
引用本頁: YiJianSuan. px ↔ rem 轉換器[EB/OL]. https://www.yijiansuan.com/zh-TW/c/dev/px-rem
本工具提供的結果僅供參考,不構成任何專業建議,請以官方核算為準。