Developer Tools
CSS to JSX Style Converter
Convert a CSS declaration list to a React JSX style object, or a JSX style object back to CSS. CamelCase, vendor prefixes, and unitless props handled.
CSS to JSX style converter
Paste a CSS declaration list and get a React style object you can drop into a JSX style prop.
296 characters
12 declarations - 333 characters - 14 lines
Conversion rules
Property names
Hyphenated CSS property names are camelCased for JSX (font-size becomes fontSize). Going the other way, camelCase keys are kebab-cased back to CSS.
Vendor prefixes
-webkit-, -moz-, and -o- prefixes capitalize the first letter (WebkitTapHighlightColor).-ms- is the documented React exception and keeps the lowercase m.
Custom properties
CSS custom properties (--accent) keep their original spelling and are emitted as bracketed string keys in the JSX object so the variable name stays exact.
Numeric values
Numbers in a JSX style object get px appended when converted to CSS, except for unitless properties such as zIndex, opacity, lineHeight, fontWeight, and the flex / grid / SVG opacity properties.
!important
The !important flag is preserved on both sides. In the JSX object it appears inside the string value because React applies setProperty to honor it.
Shorthand and url()
Shorthand values such as padding: 12px 20px stay as strings on the JSX side. Semicolons and commas inside url(), rgb(), and var() are kept intact.
What this tool does not handle
- CSS selectors, media queries, and at-rules. React inline styles only accept declarations. Wrap rules in a CSS-in-JS library (styled-components, Emotion, CSS Modules) for anything outside the body of a single rule.
- Spread elements and computed keys.
...otherand[dynamicKey]cannot be expanded without runtime values, so they are flagged in the warnings panel. - Template literals and identifiers. Values like
`${color}`ortheme.primaryneed a real JavaScript runtime to resolve. The converter skips them and notes which property was skipped. - Comments. CSS comments and JS comments inside the input are stripped from the output. Add them back where they help in your final code.
How to use
- Pick a direction at the top: CSS to JSX object, or JSX object to CSS. The sample is loaded by default so you can see the conversion immediately.
- Paste your CSS declarations or your JSX style object into the input panel. The output regenerates automatically as you type.
- In CSS to JSX mode, choose double or single quotes and 2 / 4 / tab indent to match your codebase. Click Copy as style prop to copy the full style={{ ... }} attribute.
- Check the warnings panel for any property the converter skipped, such as spreads, computed keys, or values that need a runtime to resolve.
- Use Swap to feed the current output back as the next input, Load sample to restore the example, or Clear to start fresh.
About this tool
CSS to JSX Style Converter rewrites a list of CSS declarations into the React style object shape that JSX style={{ ... }} props expect, and it can also do the reverse and turn a React style object back into plain CSS. The CSS parser splits on top-level semicolons while ignoring those inside url(), var(), rgb(), and quoted strings, so multi-value shorthand like padding: 12px 20px and background: url("a;b.png") center / cover no-repeat round-trip cleanly. CSS property names are lowercased and camelCased for the JSX side, with the standard rules for vendor prefixes (-webkit-, -moz-, and -o- capitalize the leading letter; -ms- is the documented React exception and keeps the lowercase m), and CSS custom properties such as --accent stay verbatim as bracketed string keys so the variable name survives intact. The reverse direction camelCase-to-kebab handles every prefix the same way, and any numeric value in a JSX object that targets a length-bearing property automatically gets px appended on the way to CSS, while numbers for unitless React properties (zIndex, opacity, lineHeight, fontWeight, flex, order, columnCount, the grid line shorthands, and the SVG opacity, miterlimit, and stroke length properties) stay bare. The !important flag is preserved on both sides. The parser reports clear, line-aware warnings for anything it cannot safely round-trip, including spread elements, computed keys, template literals, identifier references such as theme.primary, and stray comments, so the output stays deterministic instead of guessing. Indent size and quote style are configurable, a one-click Copy as style prop button wraps the result in style={{ ... }}, and the swap button uses the current output as the next input for back-and-forth refactoring. Everything runs locally in your browser, so the styles you paste here are never uploaded. Useful for porting design system snippets into React, converting CSS-in-JS code between libraries, cleaning up exports from no-code builders, refactoring inline styles to CSS Modules or back, and turning copied Computed style panes into ready-to-paste JSX.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
HTML to JSX Converter
Paste HTML, get React JSX with class to className, camelCase attributes, and style objects.
Open tool
DeveloperTailwind to CSS Converter
Convert Tailwind utility classes to plain CSS rules with a per-class breakdown.
Open tool
DeveloperCSS Formatter
Beautify minified CSS with indent, brace style, and sort options.
Open tool
DeveloperCSS Minifier
Compress CSS with comment, whitespace, hex, and zero-unit optimizations and a live byte-savings readout.
Open tool
DeveloperJSON to TypeScript Converter
Generate TypeScript interfaces or types from any JSON value with full inference.
Open tool