Transcode
Docs
InputCSS
OutputJSON

CSS to Javascript

Turn CSS rules into a JavaScript object you can use in CSS-in-JS.

Paste your input on the left and press Translate (or Ctrl/Cmd + Enter) to get the result on the right. Free, no sign-up.

Example

Input
.button {
    display: inline-flex;
    padding: 8px 16px;
    background-color: #5e6ad2;
    border-radius: 6px;
}

.button:hover {
    background-color: #4c57c0;
}
Output
{
    ".button": {
        "display": "inline-flex",
        "padding": "8px 16px",
        "backgroundColor": "#5e6ad2",
        "borderRadius": "6px"
    },
    ".button:hover": {
        "backgroundColor": "#4c57c0"
    }
}

Frequently asked questions

What does the output look like?
A JSON object keyed by selector, with each declaration as a property, ready to adapt for CSS-in-JS.
Where can I use the result?
In any CSS-in-JS library that accepts style objects, such as styled-components or Emotion. Check property names against the library you use.