How to Use the PX to VW Converter

Every feature explained in screen order: base width, single-value conversion, batch CSS, SCSS functions and saved settings.

The PX to VW converter turns pixel values from a design mockup into vw units that scale with the viewport width. This guide walks through every feature in screen order. If you're new, reading steps 1–3 is enough to start.

1. Set the base width

First, enter your mockup's (artboard's) width in Base width. In Figma, it's the W value shown in the right panel when you select a frame.

  • Common widths are one click away on the preset buttons (360, 375, 390, 768, 1024, 1280, 1440, 1920).
  • Desktop mockups usually use 1920 or 1440; mobile mockups use 360, 375 or 390.
  • Your base width is saved in the browser and stays the same on your next visit.

2. Convert a single value

Type a px value into PX → VW and the result appears instantly — no button needed.

  • Click a result to copy it. A "Copied" toast appears briefly at the bottom.
  • The calculation is shown under the result (e.g. 24 ÷ 1920 × 100 = 1.25vw).
  • To go the other way, use VW → PX. Turn on "Round to integer" for whole pixels.
vw = px ÷ base width × 100
Example: 96px in a 1920px mockup → 96 ÷ 1920 × 100 = 5vw

3. Decimal and unit settings

  • Decimals: 0–5 places. Two or three is plenty in practice; trailing zeros are removed automatically (5.00vw → 5vw).
  • Include unit: turn it off to copy just the number — handy for SCSS functions.

4. Common values table

The Common values table under the converter lists vw values for 1px–280px at your current base width. Click a cell to copy the vw value. Full per-width tables are on pages like 1920px, 1440px, 375px and 360px.

5. Convert a whole CSS file at once

Paste CSS into Batch CSS converter and every px value converts immediately. Use the segmented buttons at the top right to switch between px → vw and vw → px.

/* Input (1920px base) */
.title {
  font-size: 48px;
  margin-bottom: 24px;
  border: 1px solid #ddd;
}

/* Output */
.title {
  font-size: 2.5vw;
  margin-bottom: 1.25vw;
  border: 1px solid #ddd;
}

Three options cover common cases:

  • Keep ≤1px as px (on by default): thin 1px borders become invisible or blurry in vw on some screens, so they're left alone.
  • Comment original values: leaves notes like font-size: 2.5vw; /* 48px */ for later review.
  • Keep converted declarations only: removes unrelated declarations like colors and keeps only what changed — useful when producing a separate responsive stylesheet.

6. Calculate directly in SCSS or CSS

If you'd rather compute inside your code, copy a function from Calculate in SCSS or CSS at the bottom — your current base width is already filled in.

@use "sass:math";

$design-width: 1920;

@function vw($px, $base: $design-width) {
  @return math.div($px, $base) * 100vw;
}

.title { font-size: vw(48); } // → 2.5vw

7. Saved settings and shareable links

  • Base width, decimals, batch options and your last pasted CSS are stored in the browser. Nothing is sent to a server.
  • Copy link copies a URL with the current base width and input (e.g. ?base=1440&px=24) — handy for sharing exact results with teammates.

8. Tools that pair well

Try it out right awayPX to VW ConverterOpen →

Keep reading