CSS to JavaScript Object Converter

Transform CSS style declarations into a JavaScript object format for inline styling.

Instructions on Use

This tool is useful for developers who need to convert standard CSS rules into the JavaScript object format used for inline styles in libraries and frameworks like React.

  1. Paste a block of CSS declarations into the "Enter your CSS style rules" box. You should only paste the rules, not the CSS selector and curly braces.
  2. Click the "Convert" button. The tool will parse the CSS, convert property names from kebab-case (e.g., background-color) to camelCase (e.g., backgroundColor), and generate a well-formatted JavaScript object.

For example, the following CSS:

font-family: Arial, sans-serif;
-webkit-font-smoothing: antialiased;
border-bottom: 1px solid #ccc;

Will be converted into this JavaScript object:

{
  "fontFamily": "Arial, sans-serif",
  "WebkitFontSmoothing": "antialiased",
  "borderBottom": "1px solid #ccc"
}

Similar Tools

Here are some related tools for developers: