CSS px to rem converter

Calculate css px to rem converter using the values and assumptions you provide.

Calculate css px to rem converter using the values and assumptions you provide.

Both dots and commas are accepted as decimal separators.

Your inputs stay in your browser. Displayed results are rounded to a maximum of 12 significant digits.

Method and assumptions

Method version 1.0.0 · Updated

Calculate

Formula: rem = pixels / root font size

Calculate css px to rem converter using the values and assumptions you provide.

pixels
Size in pixels
rootSize
Root size (px)

Results depend on the assumptions entered; verify professional or safety-critical decisions independently.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const pixels = 24, rootFontSize = 16;
console.log(pixels / rootFontSize); // 1.5 rem
TypeScript
const pixels = 24, rootFontSize = 16;
console.log(pixels / rootFontSize); // 1.5 rem
Python
print(24 / 16)  # 1.5 rem
Java
System.out.println(24.0 / 16); // 1.5 rem
C#
Console.WriteLine(24m / 16m); // 1.5 rem