Skip to main content

    PX to REM Converter

    Convert pixels to REM and EM units. Set a custom base font-size for accurate conversions.

    No signup. 100% private. Processed in your browser.
    8px0.500rem
    10px0.625rem
    12px0.750rem
    14px0.875rem
    16px1.000rem
    18px1.125rem
    20px1.250rem
    24px1.500rem
    28px1.750rem
    32px2.000rem
    36px2.250rem
    48px3.000rem

    PX vs REM: Why It Matters

    Pixels (px) are fixed. 16px is always 16px regardless of the user's preferences. REM units are relative — 1rem equals whatever the root font size is (usually 16px by default). The difference seems small until you consider accessibility: millions of users increase their browser's default font size because they have difficulty reading small text.

    When you set font sizes, margins, and padding in rem, your entire layout scales gracefully when users change their browser settings. Set them in px, and increasing the font size can break layouts because the text grows but the containers don't. That's why modern CSS frameworks like Tailwind use rem-based spacing by default.

    This converter translates between px and rem using any base font size. The default is 16px (the browser standard), but if your project uses a different root font size, adjust the base to get accurate conversions.

    CSS Unit Comparison

    UnitRelative ToScales WithBest For
    pxNothing (absolute)NothingBorders, shadows, fine details
    remRoot font size (html)Browser settingsFont sizes, spacing, layout
    emParent font sizeParent elementComponent-level scaling
    %Parent dimensionParent sizeFluid widths and heights
    vw/vhViewport width/heightWindow sizeFull-screen layouts, hero sections
    chWidth of "0" characterFont choiceLimiting text width (max-width: 65ch)

    What this means for you: Use rem for most things (font sizes, padding, margins, gaps). Use px for things that shouldn't scale (1px borders, box shadows). Use vw/vh for viewport-relative layouts. Use ch for readable line lengths.

    Common PX to REM Conversions

    PixelsREM (base 16px)Tailwind ClassTypical Use
    4px0.25remp-1, gap-1Tight spacing, icon padding
    8px0.5remp-2, gap-2Small gaps, compact UI
    12px0.75remtext-xsCaption text, labels
    14px0.875remtext-smSecondary text, sidebar
    16px1remtext-baseBody text (browser default)
    20px1.25remtext-xlSubheadings
    24px1.5remtext-2xl, p-6Section headings, card padding
    32px2remtext-3xl, p-8Page headings, large spacing
    48px3remtext-5xlHero headings

    The 62.5% Trick

    Some developers set html { font-size: 62.5%; } to make 1rem = 10px (instead of 16px). This makes mental maths easier: 1.4rem = 14px, 2.4rem = 24px. But there are trade-offs:

    Pros

    • Easy mental conversion: 1.6rem = 16px
    • No calculator needed for common sizes

    Cons

    • Third-party components assume 16px base
    • Must reset body font-size to 1.6rem

    Related Tools

    How to use this tool

    1

    Enter a pixel value in the input field

    2

    Adjust the base font size if your project doesn't use the 16px default

    3

    See instant REM, EM, and percentage conversions

    Common uses

    • Converting pixel values to REM for accessible CSS
    • Building responsive layouts with relative units
    • Translating design specs (usually in px) to CSS rem values
    • Quick reference for Tailwind CSS spacing values

    Share this tool

    Frequently Asked Questions