Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>PX → REM ConverterNew to Visual Studio Code? Get it now.
PX → REM Converter

PX → REM Converter

avasse

| (0) | Free
Automatically converts all px values in a file to rem (16px = 1rem) via command or save action
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PX → REM Converter

A VSCode extension that automatically converts all px values to rem in a file.

  • Supports: javascript, typescript, css, scss, vue, html.
  • Works via command, keyboard shortcut, or Code Actions on Save.
  • Conversion base is configurable (default: 16px = 1rem).

Installation

  1. Download the extension or clone the repository.
  2. Open VSCode in the project folder.
  3. Press F5 to run the extension in development mode.
  4. Optionally, package or publish it on the Marketplace.

Usage

Command

  • Shortcut: Alt+D in a supported file.
  • Command Palette: Cmd+Shift+P → Convert PX to REM (whole file).

Code Actions on Save

To automatically convert all px values to rem when saving, add the following line directly in your settings.json:

"editor.codeActionsOnSave.source.fixAll.pxToRemFile": true

Conversion Base

You can customize the conversion base by adding this line directly in your settings.json:

"pxToRemFile.base": 16

  • Example: "pxToRemFile.base": 20 → 20px = 1rem.
  • Default: 16 → 16px = 1rem.

Examples

PX Value Conversion Base REM Result
32px 16 2rem
40px 20 2rem
24px 16 1.5rem

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft