Canonical: https://toolipedia.app/css-viewport-and-percentage-unit-converter

# CSS Viewport and Percentage Unit Converter

Convert pixels to vw, vh, vmin, vmax and percent of a parent size, or back to pixels, from your viewport and parent dimensions, with a CSS snippet.

Breadcrumbs: Toolipedia > Developer tools > CSS generators > CSS Viewport and Percentage Unit Converter

## About CSS Viewport and Percentage Unit Converter

CSS has units that depend on the screen and on the parent element, and pixels do not convert to them without extra numbers. Enter a pixel value together with the viewport width and height and the parent width and height, and get the matching vw, vh, vmin, vmax and percentage values with ready CSS lines. The other direction turns vw, vh or percent into pixels. Example: 360 px on a 1440 by 900 viewport is 25vw, 40vh, and 45% of an 800 px parent. A percentage height only works when the parent has a set height.

## How to use CSS Viewport and Percentage Unit Converter
1. Choose pixels to units, or units to pixels.
2. Enter the value and your viewport and parent sizes in pixels.
3. Copy the unit you need from the table, or the whole CSS snippet.

## Why use this tool?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.

## Also known as
- css viewport and percentage unit converter
- px to vw
- px to vh
- pixels to percent
- vw to px
- vmin vmax converter

## Frequently asked questions

### What is the difference between vw and a percentage width?

vw is a share of the viewport width, wherever the element sits. A percentage width is a share of the parent element's content width, so it changes when the parent changes size.

### What are vmin and vmax?

vmin is 1 percent of the smaller viewport side and vmax is 1 percent of the larger one. On a phone held upright vmin follows the width, and after rotating it follows the height.

### Why does a percentage height sometimes do nothing?

A percentage height is resolved against the parent's height. If the parent's height depends on its content, there is nothing to take a percentage of, so the browser treats it as auto.

### Is CSS Viewport and Percentage Unit Converter free?

Yes. CSS Viewport and Percentage Unit Converter on Toolipedia is free to use, with no sign-up and no watermark.

### Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

### Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

### Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

## Related tools

More free tools that go well with CSS Viewport and Percentage Unit Converter:
- [PX to REM converter](https://toolipedia.app/px-to-rem-converter)
- [CSS Component and Layout Snippet Generator](https://toolipedia.app/css-component-and-layout-snippet-generator)
- [CSS and Tailwind Converter](https://toolipedia.app/css-and-tailwind-converter)
- [CSS filter generator](https://toolipedia.app/css-filter-generator)
- [CSS Scrollbar Generator](https://toolipedia.app/css-scrollbar-generator)
