Esta página ainda não foi traduzida para o português, por isso aparece em inglês.

PX to REM Converter

Convert between pixels, rem and em with your own root font size — or paste a whole stylesheet and convert every px value in one go.

Atualizado em
The html font size — 16px in every browser by default.
em is relative to the element’s own/parent font size.
px
rem
em

Common sizes at a 16px root

Convert a CSS snippet

CSS with rem
Strings, url() and comments are left untouched.

Seus dados nunca saem do seu computador. Todo o processamento acontece localmente no navegador.

Como usar: PX to REM Converter

  1. Set the root font size (leave 16 unless your site changes the html font size).
  2. Type a value into Pixels, REM or EM — the other fields update instantly.
  3. Use the common sizes table to copy frequently used rem values with one click.
  4. To convert a whole stylesheet, paste it into Your CSS, choose the options and copy the result.

What is a rem?

rem stands for “root em”: 1rem equals the font size of the root <html> element. Browsers default that to 16px, so 1.5rem = 24px. The key difference from pixels is that rem respects the user’s browser font-size preference — someone who sets their default to 20px gets proportionally larger text and spacing, which a fixed px value would ignore.

The conversion formula

rem = px ÷ root font size and px = rem × root font size. With the default 16px root: 12px = 0.75rem, 14px = 0.875rem, 18px = 1.125rem, 32px = 2rem. em uses the same maths but divides by the font size of the element itself (for font-size, its parent), so ems compound when nested.

UnitRelative toBest for
pxNothing — fixedHairline borders, shadows, tiny details
remRoot (html) font sizeFont sizes, spacing, layout widths
emCurrent element’s font sizePadding that scales with a button’s text, icon sizes, media queries

Converting a whole CSS file

The snippet converter finds every number followed by px and divides it by your base, while skipping comments, quoted strings and url(…) paths (so bg-16px.png survives). 1px values are kept by default because borders should stay crisp. Inside media queries, rem and em are always based on the browser’s default font size (normally 16px), not on your html rule — tick Leave @media queries unchanged if your base differs.

The 62.5% trick — and why to avoid it

Setting html { font-size: 62.5%; } makes 1rem = 10px for easy maths, but every component then needs explicit font sizes and third-party widgets render tiny. Keeping the 16px default and using a converter like this one is simpler and safer.

rem in Webflow

Webflow’s unit dropdowns support rem and em, and you can type 1.5rem straight into a field. Note that a font size set on Webflow’s Body (All Pages) tag affects inherited text and em, but not rem — rem always refers to the html element. For values that scale with the screen, generate them with the clamp() Calculator.

Também pesquisado como: px to rem, rem to px, px to em, em to px, rem calculator, pixel to rem, font size converter, root font size.

Ferramentas que combinam com: PX to REM Converter

  • Conversor de unidades — Converta entre unidades métricas, imperiais e técnicas em dez categorias — com um conversor bidirecional e uma tabela que mostra todas as unidades de uma vez só.
  • CSS Formatter — Turn a minified stylesheet into readable CSS with one property per line and properly nested @media blocks.
  • CSS Minifier — Paste a stylesheet to shrink it instantly.
  • Box Shadow Generator — Stack multiple shadow layers, tweak offsets, blur, spread and opacity on a live card, then copy the box-shadow or text-shadow CSS.

Perguntas frequentes

How many pixels is 1rem?
16px in all major browsers by default, because the root font size is 16px. If a site sets html { font-size: 62.5% }, 1rem becomes 10px; if the user raises their browser font size, 1rem grows accordingly.
What is the difference between rem and em?
rem is always relative to the root html font size, so it’s predictable everywhere. em is relative to the current element’s font size, so nested ems multiply — 1.2em inside 1.2em is 1.44× the outer size.
Should I use rem or px for font sizes?
rem. It respects users’ browser font-size settings, which matters for accessibility, while zooming works with both. Pixels remain fine for borders, outlines and box-shadow offsets.
Should media queries use px, em or rem?
em or rem media queries respond to the user’s default font size, which keeps layouts from breaking when text is enlarged. Both are calculated from the browser default (usually 16px) rather than your html font-size rule.
Will the snippet converter break my CSS?
It only rewrites numbers directly followed by px, and skips comments, strings and url() values. Review the output once — especially values like 1px borders, which are kept by default.
Posso instalar o PX to REM Converter como um aplicativo da web e usá-lo offline?
Sim. O PX to REM Converter é um aplicativo da web instalável (PWA) — instalado a partir do seu navegador, não baixado de uma loja de aplicativos. Clique em “Instalar aplicativo” na parte superior desta página no Chrome ou no Edge (Windows, macOS, Linux, ChromeOS) ou, no Android, use “Compartilhar” → “Adicionar à tela inicial” no iPhone e no iPad, ou “Arquivo” → “Adicionar ao Dock” no Safari 17+ em um Mac. Em seguida, ela se abre em uma janela própria com seu próprio ícone e, como é executada inteiramente no seu navegador, continua funcionando offline. O Firefox no desktop não permite a instalação de aplicativos da web. Como funciona a instalação.

Ferramentas relacionadas