Skip to content
Tesserae

Keyboard shortcuts

Focus search
/
This help dialog
?
Run the current tool
Ctrl/⌘ +Enter
Copy the output (when an output is focused)
Ctrl/⌘ +C

Shortcuts are ignored while you are typing in an input, a textarea or a select.

Web & CSS

CSS to JS Object

Paste a CSS declaration list (color: red; font-size: 12px) or a rule block (a:hover { color: red }) and get the equivalent JS object with camelCase keys for CSS-in-JS, React inline styles or style objects. Handles comments, multiple rules, vendor prefixes (-webkit- → Webkit-), custom properties (~), and existing camelCase names unchanged.

On-device No network Offline-ready

🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.

Try:

Options

Your result will appear here

Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.

How it works

Declaration lists and rule blocks

Paste a bare declaration list such as color: red; font-size: 12px and get one flat object, or paste complete rules and get an object keyed by selector, so a:hover becomes a quoted key whose value is its own style object. The parser tracks quotes and braces, so semicolons inside a quoted value do not split a declaration and an unbalanced brace is reported rather than guessed at.

Property names for react

With camelCase on, font-size becomes fontSize and background-color becomes backgroundColor, which is the shape React inline styles and most CSS-in-JS libraries expect. Turning it off keeps property names verbatim for frameworks that want kebab-case keys. Custom properties are never camelCased.

Prefixes and comments

A vendor prefix is capitalised after the dash, so -webkit-transform becomes WebkitTransform, matching the JavaScript property name. Block comments are stripped before parsing, and a declaration with no colon is ignored rather than breaking the output, which keeps a pasted stylesheet resilient to stray text.

Converted in the page

The stylesheet text is parsed by plain string handling in this tab. Nothing is uploaded, no request is sent to any server, and the resulting object is produced instantly from the bytes you pasted.

Questions

What if my input is a full rule, not a declaration list?

Both work. A rule is converted to a nested object keyed by selector, e.g. a:hover becomes "a:hover": { color: "red" }; a bare declaration list becomes a flat object.

How are vendor prefixes handled?

-webkit-transform becomes WebkitTransform (capitalised after the dash) like React expects. CSS custom properties (--accent) are left untouched since they are not camelCased.

Is the output always a single object?

Yes — one flat object for a declaration list, or one object with selectors as keys when rules are given. Value strings are escaped so the output is always valid JS.

See category