# CSS Unit Converter (`automation-lab/css-unit-converter`) Actor

Convert CSS units (px, em, rem, pt, vh, vw, cm, mm, in, pc) with context-aware base font size and viewport dimensions. Returns a full 10-unit conversion table for each input value.

- **URL**: https://apify.com/automation-lab/css-unit-converter.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## CSS Unit Converter

Convert CSS units instantly — px, em, rem, pt, vh, vw, cm, mm, in, and pc — with full context-awareness for font size and viewport dimensions. Get a complete conversion table for every value in a single API call.

### What does CSS Unit Converter do?

CSS Unit Converter is a pure-math utility actor that converts any CSS measurement value into all other CSS units simultaneously. Provide a list of values with their source units, set your viewport dimensions and base font size, and receive a complete conversion table with every result in px, em, rem, pt, vh, vw, cm, mm, in, and pc.

Unlike browser-based tools that require a real DOM context, this actor uses **precise CSS specification math** — the same formulas browsers use — so results are reliable, deterministic, and reproducible across any environment.

**Supported units:** `px`, `em`, `rem`, `pt`, `vh`, `vw`, `cm`, `mm`, `in`, `pc`

### Who is CSS Unit Converter for?

#### 🧑‍💻 Front-end developers working across design systems

You're migrating a legacy codebase from pixel-based to rem-based typography. You need to convert dozens of hardcoded `px` values to `rem` equivalents without manually dividing each by 16. Feed the entire list to this actor and get all conversions in one structured response.

- Batch-convert entire token lists (spacing, font sizes, line heights)
- Compare em vs rem to understand parent-relative cascading effects
- Generate conversion tables for design handoff documentation

#### 🎨 UI/UX designers bridging design tools and code

Your Figma mockup uses pixels but your dev team works in rem. You need to translate design specs into CSS values that match the codebase's base font size — quickly and accurately.

- Convert Figma px measurements to rem/em for CSS
- Verify pt measurements from print designs match CSS pixel equivalents
- Generate reference tables for design-to-code annotation

#### 🖨️ Print CSS specialists

You're styling `@media print` stylesheets and need to reconcile px/em values with physical units (cm, mm, in, pt) for exact paper layout.

- Convert screen px values to physical print units
- Verify 1in = 96px = 72pt = 2.54cm at CSS standard DPI
- Generate accurate page margin and column width values

#### ⚙️ Build tools and CSS preprocessor pipelines

You're building a Sass/Less mixin generator or a design token transformer that needs CSS unit math as a service. This actor provides a reliable, language-agnostic calculation endpoint.

- Integrate via API into any programming language
- Use as a calculation step in CI/CD pipelines
- Automate conversion tables for generated CSS

### Why use CSS Unit Converter?

- 🎯 **100% accurate** — implements the CSS specification conversion formulas exactly
- ⚡ **Zero latency** — pure math, no HTTP scraping, no browser overhead
- 📦 **Batch processing** — convert dozens of values in a single API call
- 🔧 **Context-aware** — respects your actual base font size (rem) and viewport (vw/vh)
- 🎛️ **Filterable output** — request only the target units you need
- 💰 **Near-zero cost** — no proxy, no browser, pure computation
- 🔗 **API-first** — JSON in, JSON out — integrate anywhere

### What data can you extract?

Each conversion set returns:

| Field | Type | Description |
|-------|------|-------------|
| `label` | string | Optional label from your input |
| `inputValue` | number | The original value you provided |
| `fromUnit` | string | The source CSS unit |
| `px` | number | Value in pixels |
| `em` | number | Value in em (relative to context font size) |
| `rem` | number | Value in rem (relative to root font size) |
| `pt` | number | Value in points (1pt = 1/72 in) |
| `vh` | number | Value in viewport height units |
| `vw` | number | Value in viewport width units |
| `cm` | number | Value in centimeters |
| `mm` | number | Value in millimeters |
| `in` | number | Value in inches |
| `pc` | number | Value in picas (1pc = 12pt) |
| `conversions` | object | All converted values as a flat key-value map |
| `context` | object | The context used: baseFontSizePx, contextFontSizePx, viewportWidthPx, viewportHeightPx |
| `error` | string\|null | Error message if conversion failed (bad unit, invalid value) |

### How much does it cost to convert CSS units?

CSS Unit Converter uses Pay-Per-Event (PPE) pricing — you pay only for what you use.

| Event | FREE tier | BRONZE | SILVER | GOLD | PLATINUM | DIAMOND |
|-------|-----------|--------|--------|------|----------|---------|
| Run started (one-time) | $0.005 | $0.00475 | $0.00425 | $0.00375 | $0.003 | $0.0025 |
| Per conversion set | $0.001 | $0.0009 | $0.0008 | $0.00065 | $0.0005 | $0.0004 |

**Real-world cost examples:**

- Convert 10 CSS values: $0.005 (start) + $0.01 (10 × $0.001) = **$0.015**
- Convert 100 CSS values: $0.005 + $0.10 = **$0.105**
- Convert 500 CSS values: $0.005 + $0.50 = **$0.505**

**Free plan estimate:** Apify's free $5/month in credits covers approximately **4,900 conversion sets** per month — more than enough for typical design-system work.

### How to convert CSS units

1. Go to the [CSS Unit Converter page](https://apify.com/automation-lab/css-unit-converter) on Apify Store
2. Click **Try for free**
3. Add your CSS values in the **Values to Convert** field (JSON array format)
4. Set **Base font size** (default 16px — the browser default)
5. Set **Viewport width** and **Viewport height** (for vw/vh conversions)
6. Optionally fill in **Target units** to filter output (leave empty for all units)
7. Click **Start** and download results as JSON, CSV, or Excel

**Input examples:**

Convert a single font size:
```json
{
    "conversions": [
        { "value": 16, "fromUnit": "px", "label": "Body font" }
    ],
    "baseFontSizePx": 16,
    "viewportWidthPx": 1440,
    "viewportHeightPx": 900
}
````

Convert a complete type scale:

```json
{
    "conversions": [
        { "value": 12, "fromUnit": "px", "label": "xs" },
        { "value": 14, "fromUnit": "px", "label": "sm" },
        { "value": 16, "fromUnit": "px", "label": "base" },
        { "value": 18, "fromUnit": "px", "label": "lg" },
        { "value": 24, "fromUnit": "px", "label": "xl" },
        { "value": 30, "fromUnit": "px", "label": "2xl" },
        { "value": 36, "fromUnit": "px", "label": "3xl" },
        { "value": 48, "fromUnit": "px", "label": "4xl" }
    ],
    "baseFontSizePx": 16,
    "viewportWidthPx": 1440,
    "viewportHeightPx": 900,
    "targetUnits": ["px", "rem", "pt"]
}
```

### Input parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `conversions` | array | required | List of CSS values to convert. Each item: `{ value, fromUnit, label? }` |
| `conversions[].value` | number | required | Numeric CSS value to convert |
| `conversions[].fromUnit` | string | required | Source CSS unit: `px`, `em`, `rem`, `pt`, `vh`, `vw`, `cm`, `mm`, `in`, `pc` |
| `conversions[].label` | string | optional | Human-readable label to identify this value in the output |
| `baseFontSizePx` | integer | 16 | Root font size (px) for rem conversions. Browser default is 16px. |
| `contextFontSizePx` | integer | = baseFontSizePx | Parent element font size (px) for em conversions |
| `viewportWidthPx` | integer | 1440 | Viewport width (px) for vw conversions |
| `viewportHeightPx` | integer | 900 | Viewport height (px) for vh conversions |
| `targetUnits` | array | \[] (all) | Filter output to specific units. Empty = return all 10 units |
| `precision` | integer | 4 | Decimal places for converted values (0-10) |

### Output examples

Input: `16px` with default context (16px base, 1440×900 viewport)

```json
{
    "label": "Body font size",
    "inputValue": 16,
    "fromUnit": "px",
    "context": {
        "baseFontSizePx": 16,
        "contextFontSizePx": 16,
        "viewportWidthPx": 1440,
        "viewportHeightPx": 900
    },
    "px": 16,
    "em": 1,
    "rem": 1,
    "pt": 12,
    "vh": 1.7778,
    "vw": 1.1111,
    "cm": 0.4233,
    "mm": 4.2333,
    "in": 0.1667,
    "pc": 1,
    "conversions": {
        "px": 16,
        "em": 1,
        "rem": 1,
        "pt": 12,
        "vh": 1.7778,
        "vw": 1.1111,
        "cm": 0.4233,
        "mm": 4.2333,
        "in": 0.1667,
        "pc": 1
    },
    "error": null
}
```

Input: `72pt` (print heading)

```json
{
    "label": "Print heading",
    "inputValue": 72,
    "fromUnit": "pt",
    "px": 96,
    "em": 6,
    "rem": 6,
    "pt": 72,
    "vh": 10.6667,
    "vw": 6.6667,
    "cm": 2.54,
    "mm": 25.4,
    "in": 1,
    "pc": 6,
    "error": null
}
```

### Tips for best results

- 💡 **Start small** — use the prefilled example (6 values) to verify the actor works as expected before submitting large batches
- 🔧 **Always set baseFontSizePx** — if your project uses 14px or 18px as the root font size, set it explicitly to get accurate rem values
- 📐 **Set contextFontSizePx for em conversions** — em is relative to the *parent* element, not the root. If you're converting inside a component with 14px font, set `contextFontSizePx: 14`
- 🖥️ **Set real viewport dimensions** — use your actual breakpoint widths for accurate vw/vh values. For mobile-first: 390×844 (iPhone 14), for desktop: 1440×900
- 🎯 **Use targetUnits to reduce noise** — if you only need px→rem conversions, specify `targetUnits: ["rem"]` to get clean, focused output
- 🏷️ **Always use labels** — add a `label` to each conversion item so the output is self-documenting and easy to reference in your codebase
- 🔢 **Adjust precision** — use `precision: 6` for scientific accuracy in print layouts, `precision: 2` for practical CSS values

### Integrations

**CSS Unit Converter → Google Sheets for design token libraries:**
Export the JSON output and use Apify's Google Sheets integration to populate a live token table. Design teams can view the full px/rem/pt table and copy values directly into Figma or code annotations.

**CSS Unit Converter → Make.com or Zapier for design system pipelines:**
Trigger a conversion run whenever your design tokens file is updated. Automatically push the results to a Notion database or Confluence page for developer reference.

**CSS Unit Converter → Node.js/Python build scripts:**
Call the API directly in your design token transformer (Style Dictionary, Theo, etc.) to convert pixel values in your token JSON files to multi-unit outputs during the build step.

**Scheduled runs for viewport documentation:**
Schedule monthly runs with different viewport presets (mobile, tablet, desktop) to keep your responsive breakpoint conversion tables up to date in documentation.

**CSS Unit Converter → Slack alerts for design reviews:**
When a designer submits new pixel values for review, trigger a conversion run and post the rem/pt equivalents to a Slack channel for the dev team to review before implementation.

### Using the Apify API

#### Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('automation-lab/css-unit-converter').call({
    conversions: [
        { value: 16, fromUnit: 'px', label: 'Body font' },
        { value: 1.5, fromUnit: 'rem', label: 'Heading' },
    ],
    baseFontSizePx: 16,
    viewportWidthPx: 1440,
    viewportHeightPx: 900,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_APIFY_TOKEN')

run = client.actor('automation-lab/css-unit-converter').call(run_input={
    'conversions': [
        {'value': 16,  'fromUnit': 'px',  'label': 'Body font'},
        {'value': 1.5, 'fromUnit': 'rem', 'label': 'Heading'},
    ],
    'baseFontSizePx': 16,
    'viewportWidthPx': 1440,
    'viewportHeightPx': 900,
})

items = client.dataset(run['defaultDatasetId']).list_items().items
for item in items:
    print(item)
```

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/automation-lab~css-unit-converter/runs" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "conversions": [
      {"value": 16, "fromUnit": "px", "label": "Body font"},
      {"value": 1.5, "fromUnit": "rem", "label": "Heading"}
    ],
    "baseFontSizePx": 16,
    "viewportWidthPx": 1440,
    "viewportHeightPx": 900
  }'
```

### Use with AI agents via MCP

CSS Unit Converter is available as a tool for AI assistants that support the [Model Context Protocol (MCP)](https://docs.apify.com/platform/integrations/mcp).

Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:

#### Setup for Claude Code

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/css-unit-converter"
```

#### Setup for Claude Desktop, Cursor, or VS Code

Add this to your MCP config file:

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com?tools=automation-lab/css-unit-converter",
            "headers": {
                "Authorization": "Bearer YOUR_APIFY_TOKEN"
            }
        }
    }
}
```

**Example prompts for AI agents:**

- *"Convert my entire spacing scale (4, 8, 12, 16, 24, 32, 48, 64px) to rem and em values using 16px base font size."*
- *"I'm building a print stylesheet. Convert these em values to pt and cm: 1em, 1.5em, 2em, 3em."*
- *"Generate a full conversion table for 1rem with base font 16px and a 1920x1080 viewport."*

### Is it legal to use CSS Unit Converter?

CSS Unit Converter performs **pure mathematical calculations** — it does not scrape any website, access any external service, or process any user data. The conversion formulas implement the published [CSS specification from W3C](https://www.w3.org/TR/css-values-4/#lengths), which is open and freely available.

There are **no legal restrictions** on using mathematical CSS unit conversions. This actor is equivalent to running the calculations in your own code — it simply provides a convenient, hosted API endpoint.

### FAQ

**What CSS units are supported?**
All 10 common CSS length units: `px` (pixels), `em` (parent font-relative), `rem` (root font-relative), `pt` (points), `vh` (viewport height), `vw` (viewport width), `cm` (centimeters), `mm` (millimeters), `in` (inches), `pc` (picas). Percentage (`%`), `ch`, `ex`, `vmin`, `vmax` are not supported in this version.

**What's the difference between em and rem?**
`rem` is relative to the **root** (html) font size — typically 16px. `em` is relative to the **current element's** font size, which can vary throughout the DOM. Set `baseFontSizePx` for rem and `contextFontSizePx` for em conversions.

**How accurate are the conversions?**
Conversions use exact CSS specification math: 1in = 96px, 1in = 72pt, 1in = 6pc, 1in = 2.54cm, 1in = 25.4mm. These are the fixed ratios defined in the CSS spec — the same values browsers use for absolute length units.

**Do vh/vw conversions require a real browser?**
No. vh and vw are simply percentages of the viewport dimensions you provide. Set `viewportWidthPx` and `viewportHeightPx` to your target viewport size and the math is deterministic.

**Why do my em values look wrong?**
The `em` unit is relative to the parent element's font size, not the root. If you're converting inside a component where the font size is 14px (not 16px), set `contextFontSizePx: 14`. The default `contextFontSizePx` equals `baseFontSizePx`.

**Why are some fields null in the output?**
When you use `targetUnits` to filter output, only the specified units appear in the flat fields — other unit fields are `null`. The `conversions` object only contains the units you requested. Remove `targetUnits` (or set it to `[]`) to get all 10 units.

**The actor returned an error for one of my items — what happened?**
Check the `error` field on the failed item. Common causes: unrecognized source unit (must be one of the 10 supported units, lowercase), or a non-finite number value. Valid items in the same run still succeed — the actor does not abort on individual errors.

**How fast is it?**
Extremely fast. Each conversion is ~0.1ms of CPU. A batch of 1,000 values typically completes in under 2 seconds total (including Actor startup overhead).

### Other CSS and design tools

Looking for more developer utilities? Check out these other tools from [automation-lab](https://apify.com/automation-lab):

- 🎨 [Color Contrast Checker (WCAG)](https://apify.com/automation-lab/color-contrast-checker) — Validate color pairs against WCAG 2.1 AA/AAA accessibility standards
- 🔗 [JSON Schema Generator](https://apify.com/automation-lab/json-schema-generator) — Generate JSON Schema from sample JSON objects automatically
- 🌐 [DNS Checker](https://apify.com/automation-lab/dns-checker) — Bulk DNS lookup with A, AAAA, MX, CNAME, TXT records
- 🔒 [SSL Certificate Checker](https://apify.com/automation-lab/ssl-checker) — Check SSL certificate validity, expiry, and chain across domains
- 📧 [Email Validator](https://apify.com/automation-lab/email-validator) — Validate email addresses with MX record verification and syntax checks

# Actor input Schema

## `conversions` (type: `array`):

List of CSS values to convert. Each item specifies a numeric value and its source unit. Example: <code>{"value": 16, "fromUnit": "px"}</code>

## `baseFontSizePx` (type: `integer`):

Root font size in pixels used for rem conversions. Typically 16px (browser default). Used to convert between rem and px.

## `contextFontSizePx` (type: `integer`):

Parent element font size in pixels used for em conversions. Defaults to baseFontSizePx if omitted.

## `viewportWidthPx` (type: `integer`):

Viewport width in pixels used for vw conversions. Typical desktop: 1440px, mobile: 390px.

## `viewportHeightPx` (type: `integer`):

Viewport height in pixels used for vh conversions. Typical desktop: 900px, mobile: 844px.

## `targetUnits` (type: `array`):

If specified, only output conversions for these units. Leave empty to get all units.

## `precision` (type: `integer`):

Number of decimal places for converted values. Default: 4.

## Actor input object example

```json
{
  "conversions": [
    {
      "value": 16,
      "fromUnit": "px",
      "label": "Body font size"
    },
    {
      "value": 1.5,
      "fromUnit": "rem",
      "label": "H2 heading"
    },
    {
      "value": 100,
      "fromUnit": "vh",
      "label": "Full-screen height"
    },
    {
      "value": 72,
      "fromUnit": "pt",
      "label": "Print heading"
    }
  ],
  "baseFontSizePx": 16,
  "contextFontSizePx": 16,
  "viewportWidthPx": 1440,
  "viewportHeightPx": 900,
  "targetUnits": [],
  "precision": 4
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "conversions": [
        {
            "value": 16,
            "fromUnit": "px",
            "label": "Body font size"
        },
        {
            "value": 1.5,
            "fromUnit": "rem",
            "label": "H2 heading"
        },
        {
            "value": 100,
            "fromUnit": "vh",
            "label": "Full-screen height"
        },
        {
            "value": 72,
            "fromUnit": "pt",
            "label": "Print heading"
        }
    ],
    "baseFontSizePx": 16,
    "contextFontSizePx": 16,
    "viewportWidthPx": 1440,
    "viewportHeightPx": 900,
    "targetUnits": [],
    "precision": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/css-unit-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "conversions": [
        {
            "value": 16,
            "fromUnit": "px",
            "label": "Body font size",
        },
        {
            "value": 1.5,
            "fromUnit": "rem",
            "label": "H2 heading",
        },
        {
            "value": 100,
            "fromUnit": "vh",
            "label": "Full-screen height",
        },
        {
            "value": 72,
            "fromUnit": "pt",
            "label": "Print heading",
        },
    ],
    "baseFontSizePx": 16,
    "contextFontSizePx": 16,
    "viewportWidthPx": 1440,
    "viewportHeightPx": 900,
    "targetUnits": [],
    "precision": 4,
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/css-unit-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "conversions": [
    {
      "value": 16,
      "fromUnit": "px",
      "label": "Body font size"
    },
    {
      "value": 1.5,
      "fromUnit": "rem",
      "label": "H2 heading"
    },
    {
      "value": 100,
      "fromUnit": "vh",
      "label": "Full-screen height"
    },
    {
      "value": 72,
      "fromUnit": "pt",
      "label": "Print heading"
    }
  ],
  "baseFontSizePx": 16,
  "contextFontSizePx": 16,
  "viewportWidthPx": 1440,
  "viewportHeightPx": 900,
  "targetUnits": [],
  "precision": 4
}' |
apify call automation-lab/css-unit-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=automation-lab/css-unit-converter",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "CSS Unit Converter",
        "description": "Convert CSS units (px, em, rem, pt, vh, vw, cm, mm, in, pc) with context-aware base font size and viewport dimensions. Returns a full 10-unit conversion table for each input value.",
        "version": "0.1",
        "x-build-id": "YkH4CU750Y6e7QY3P"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/automation-lab~css-unit-converter/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-automation-lab-css-unit-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/automation-lab~css-unit-converter/runs": {
            "post": {
                "operationId": "runs-sync-automation-lab-css-unit-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/automation-lab~css-unit-converter/run-sync": {
            "post": {
                "operationId": "run-sync-automation-lab-css-unit-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "conversions"
                ],
                "properties": {
                    "conversions": {
                        "title": "📐 Values to convert",
                        "type": "array",
                        "description": "List of CSS values to convert. Each item specifies a numeric value and its source unit. Example: <code>{\"value\": 16, \"fromUnit\": \"px\"}</code>",
                        "items": {
                            "type": "object",
                            "required": [
                                "value",
                                "fromUnit"
                            ],
                            "properties": {
                                "value": {
                                    "type": "number",
                                    "title": "Value",
                                    "description": "Numeric CSS value to convert."
                                },
                                "fromUnit": {
                                    "type": "string",
                                    "title": "Source unit",
                                    "description": "CSS unit of the input value (px, em, rem, pt, vh, vw, cm, mm, in, pc)."
                                },
                                "label": {
                                    "type": "string",
                                    "title": "Label",
                                    "description": "Optional label to identify this conversion in the output."
                                }
                            }
                        }
                    },
                    "baseFontSizePx": {
                        "title": "Base font size (px)",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Root font size in pixels used for rem conversions. Typically 16px (browser default). Used to convert between rem and px.",
                        "default": 16
                    },
                    "contextFontSizePx": {
                        "title": "Context font size (px)",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Parent element font size in pixels used for em conversions. Defaults to baseFontSizePx if omitted."
                    },
                    "viewportWidthPx": {
                        "title": "Viewport width (px)",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Viewport width in pixels used for vw conversions. Typical desktop: 1440px, mobile: 390px.",
                        "default": 1440
                    },
                    "viewportHeightPx": {
                        "title": "Viewport height (px)",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Viewport height in pixels used for vh conversions. Typical desktop: 900px, mobile: 844px.",
                        "default": 900
                    },
                    "targetUnits": {
                        "title": "Target units (optional filter)",
                        "type": "array",
                        "description": "If specified, only output conversions for these units. Leave empty to get all units.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "precision": {
                        "title": "Decimal precision",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Number of decimal places for converted values. Default: 4.",
                        "default": 4
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
