Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>px-to-unitsNew to Visual Studio Code? Get it now.
px-to-units

px-to-units

feikkzk

|
2 installs
| (0) | Free
convert pixels to any css size
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

📐 px‑to‑units

A tiny VS Code extension that instantly converts px to rem, vw, em & more right from your autocomplete 🤯

VS Code Marketplace Downloads License

Banner


✨ Features

  • 🧠 Smart autocomplete: suggestions appear automatically after any px value or Control + Space.
  • 🌎 Supports CSS, SCSS/Sass, Less, PostCSS and CSS‑in‑JS blocks.
  • 🎛️ Customisable base values (rootFontSize, viewportWidth, precision).
  • ⚡ Zero‑config: works right out of the box.

📺 Demo

CSS demo

The demos above convert 16px to 1rem, 0.83vw, 1em, etc.


🚀 Quick Start

  1. Install from the VS Code Marketplace or run:

    ext install px-to-units.px-to-units
    
  2. Open any .css, .scss, .sass, .less, or .pcss file.

  3. Type a rule with a pixel value:

    font-size: 12px;
    

    Once you finish typing px, the extension will show suggestions (like rem, vw, em) to replace it.

  4. 🎉 Done! The selected unit replaces the pixel value — no manual maths 🧮.


⚙️ Extension Settings

Setting Default Description
pxToUnits.rootFontSize 16 Base font‑size used for rem / em conversions.
pxToUnits.viewportWidth 1920 Viewport width used for vw conversions.
pxToUnits.decimalPlaces 2 Number of decimals to keep in suggestions.
pxToUnits.additionalUnits [] Array of custom units & formulas.

Access settings via File → Preferences → Settings → Extensions → px‑to‑units.


🧩 Supported Languages & Scopes

Language Scope ID
CSS css
SCSS / Sass scss, sass
Less less
PostCSS postcss
CSS‑in‑JS (template‑literal blocks) javascriptreact, typescriptreact

📄 License

Released under the MIT license © 2025 fab-henao.


Built with ❤️ & TypeScript. Enjoy your new responsive workflow! 🚀

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