CSS 단위 변환기 (px를 rem, em, pt로)

루트 요소 글꼴 크기, 부모 요소 글꼴 크기 및 DPI를 사용하여 px를 rem, em, pt, 파이카, 인치, mm로 변환합니다. CSS는 1 in = 96 px = 72 pt로 정의합니다.

업데이트 검증한 예제: 7

px
추가 옵션
px
DPI
CSS fixes 1 in = 96 px. Enter a screen or printer density (e.g. 300) to count physical pixels instead.
시도하기
변환된 값
rem
변환된 값: 1.5 rem
유효 자릿수: 10; 가장 가까운 값, 중간값은 0에서 먼 쪽으로
As CSS
1.5rem
In pixels
24px

24px is 1.5rem with a 16 px root font and 96 pixels per inch.

Size in pixels next to the font sizes

24px24 px1 rem (root)16 px1 em (parent)16 px
24px in every unit 행 수: 10
단위값정의
Pixels (px)24px1 px
Points (pt)18pt1 pt = 1/72 in
Picas (pc)1.5pc1 pc = 12 pt = 1/6 in
Inches (in)0.25in1 in = DPI px
Centimetres (cm)0.635cm1 cm = 1/2.54 in
Millimetres (mm)6.35mm1 mm = 1/25.4 in
Quarter-millimetres (Q)25.4Q1 Q = 0.25 mm
em (parent font size)1.5em1 em = parent font size
rem (root font size)1.5rem1 rem = root font size
Percent of parent font size (%)150%100% = parent font size
계산 방법 S
  1. Pixels in one px

    1 px=1 px1\,\text{px} = 1\ \text{px}

    1 px

  2. Value in pixels

    24×1=24 px24 \times 1 = 24\ \text{px}
  3. Divide by pixels in one rem

    2416=1.5 rem\frac{24}{16} = 1.5\ \text{rem}

    1 rem = root font size

CSS 단위 변환기 (px를 rem, em, pt로) 소개

CSS converts every length through pixels. The absolute units are fixed to each other: 1 in = 2.54 cm = 96 px = 72 pt = 6 pc, and 1 Q is a quarter of a millimetre. The font-relative units depend on the page: 1 rem is the root element's font size, and when you set font-size, 1 em (or 100%) is the parent's font size. The converter turns the value into pixels, then divides by the pixels in one target unit.

Front-end developers use it to turn a design's pixel sizes into rem, so text follows the reader's browser font setting: with the default 16 px root, 24 px is 1.5 rem. Print designers use the pixels-per-inch field instead; at 300 DPI a 10 mm logo needs about 118 pixels.

On screens a CSS inch is not a measured inch. Browsers anchor 96 px to a reference pixel of about 0.0213° of visual angle, so physical units match a ruler only in print.

계산 예제

24 px in rem

값
24
변환 전
Pixels (px)
변환 후
rem (root font size)
Root font size (for rem)
16 px
변환된 값
1.5 rem
As CSS
1.5rem
In pixels
24 px

검증 출처: CSS Values 3 §6.1: 1rem = root font size (16 px browser default); 24 / 16 = 1.5

12 pt in px

값
12
변환 전
Points (pt)
변환 후
Pixels (px)
Root font size (for rem)
16 px
변환된 값
16 px
As CSS
16px

검증 출처: CSS Values 3 §6.2: 1pt = 1/72 in, 1in = 96px; 12 × 96/72 = 16

1 inch in CSS pixels

값
1
변환 전
인치 (in)
변환 후
Pixels (px)
Root font size (for rem)
16 px
변환된 값
96 px

검증 출처: CSS Values 3 §6.2: 1in = 96px

1.5 rem in px

값
1.5
변환 전
rem (root font size)
변환 후
Pixels (px)
Root font size (for rem)
16 px
변환된 값
24 px

검증 출처: 1 rem = root font size (16 px); 1.5 × 16

자주 묻는 질문

How many pixels is 1 rem?

16 pixels by default. One rem equals the font size of the root html element, and the major browsers set that to 16 px unless the reader changes the default font size or the stylesheet sets html { font-size }. Setting html { font-size: 62.5% } makes 1 rem = 10 px. The W3C CSS Values and Units specification defines rem; the 16 px figure is the browser default, not part of the specification.

How do I convert px to pt?

Multiply pixels by 0.75; to go from points to pixels, multiply by 4/3 (about 1.333). Both factors follow from the W3C CSS rule 1 in = 96 px = 72 pt, so 1 px = 72/96 pt. Body text at 16 px is 12 pt, and 11 pt text from a word processor is about 14.67 px.

What is the difference between em and rem?

rem always refers to the root element's font size; em refers to the current element's font size, or to the parent's when used on font-size itself. So em compounds when nested: a list set to 1.2em inside another list set to 1.2em has text 1.44 times the outer size, while 1.2rem stays at 19.2 px with a 16 px root however deep it sits.

Should I use px or rem for font sizes?

Use rem if text should follow the reader's browser font-size setting. Page zoom enlarges px and rem alike, but the default font-size preference changes only rem, em and percentage sizes. WCAG 2.1 success criterion 1.4.4 (level AA) requires text that can be resized to 200% without loss of content or function; browser zoom can meet it with px, and rem also honours the font-size preference.

Is a CSS inch the same as a real inch?

Only in print. CSS defines 1 in as exactly 96 px, and on screens browsers anchor the pixel to the W3C reference pixel: one pixel of a 96 DPI screen seen from 28 in away, a visual angle of about 0.0213°. Phones are held closer and use smaller pixels, so a 96 px box measures well under an inch on most phones. Printers anchor to physical units, so 1 in prints as 25.4 mm.

“CSS 단위 변환기 (px를 rem, em, pt로)”의 정확도는 어느 정도인가요?

정확도는 입력값과 계산 방법의 가정에 따라 달라집니다. 십진 연산은 유효숫자 50자리를 사용하지만, 추정값·수치해석 방법·원본 데이터의 정밀도는 더 낮을 수 있습니다. 표시값을 반올림해도 이러한 한계는 사라지지 않습니다. 독립적인 출처의 풀이와 대조한 계산 예시: 7. 예를 들어 “24 px in rem”은 CSS Values 3 §6.1: 1rem = root font size (16 px browser default); 24 / 16 = 1.5와 대조해 확인합니다.

이 계산 방법의 출처는 무엇인가요?

W3C — CSS Values and Units Module Level 3, §6.2 absolute lengths and §6.1 font-relative lengths.

이 계산기 소개

to=value×px per from-unitpx per to-unit1 in=96 px=72 pt=2.54 cm\begin{gathered} \text{to} = \text{value} \times \frac{\text{px per from-unit}}{\text{px per to-unit}} \\ 1\,\text{in} = 96\,\text{px} = 72\,\text{pt} = 2.54\,\text{cm} \end{gathered}

출처

  1. W3C — CSS Values and Units Module Level 3, §6.2 absolute lengths and §6.1 font-relative lengths

출처와 대조하여 검증

이 계산기에는 독립적인 출처에서 답을 얻은 계산 예제가 7개 있습니다. 테스트 모음에서 실행되며 여기에서도 실행할 수 있습니다.

관련 계산기