CSS Logical Properties
Convert CSS physical properties (margin-left, width) to logical properties (margin-inline-start, inline-size) for RTL/LTR support.
Lines: 18Characters: 342Converted Properties: 16
Presets:
Physical CSS Input
Logical CSS Output
CSS Logical Properties Converter
CSS Logical Properties map physical directions (top, left, right, bottom) to logical directions that respect the document writing mode. In a left-to-right document, margin-inline-start equals margin-left; in RTL it automatically maps to margin-right. Logical properties are now supported in all modern browsers (Chrome 89+, Firefox 68+, Safari 15+).
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Converting a stylesheet so it works in right-to-left languages without a separate sheet.
- Replacing directional margins with flow-relative ones during an internationalisation pass.
- Learning the logical equivalent of a property you use constantly.
- Auditing a component for physical properties that will break in RTL.
- Producing a converted block to compare against the original.
Frequently Asked Questions
- What do block and inline mean here?
- Inline is the direction text runs; block is the direction lines stack. In English those are horizontal and vertical, so
margin-inline-startismargin-left— but in Arabic or Hebrew it becomesmargin-right, and in vertical Japanese the two axes swap entirely. - Why bother if my site is English-only?
- Two reasons that apply anyway: one property replaces two (
margin-inline: 1remsets both sides), and a component written logically can be dropped into an RTL context later without a second stylesheet. If neither matters to you, physical properties are not wrong. - What is the shorthand?
margin-blockandmargin-inlineeach take one or two values —margin-block: 1rem 2remis start then end. The same pattern applies to padding, border, andinsetfor positioning, whereinset-inline-startreplacesleft.- Do width and height have equivalents?
- Yes:
inline-sizeandblock-size, withmin-andmax-variants. These are the ones people forget, and they matter most — a fixedwidthon a component breaks in vertical writing modes exactly whereinline-sizewould have adapted. - What browser support do they have?
- The margin, padding, border and inset properties have been supported across every current browser since around 2019–2021, so they are safe today. If you must support very old browsers, keep a physical fallback declaration *before* the logical one.
- What happens when I mix logical and physical properties?
- They compete through the normal cascade, and the later declaration wins regardless of which kind it is.
margin-inline-startfollowed bymargin-leftleaves the physical value in place, which is why partial migrations produce puzzling results. - Do they follow vertical writing modes too?
- Yes — that is the point. In
writing-mode: vertical-rlthe inline axis runs top to bottom, sopadding-inlinebecomes vertical padding. Physical properties keep their screen meaning and stop tracking the text.
Common errors and gotchas
- Converting only some properties, which leaves a component half-adapted and worse than either.
- Assuming logical properties handle RTL entirely, when icons, shadows and imagery also need flipping.
- Converting a property where physical direction was genuinely intended, such as a fixed drop shadow.
- Overlooking that inline and block axes swap in vertical writing modes, not just RTL.
- Mixing logical and physical properties on the same element, where precedence gets confusing.
Related Design & CSS tools
Color Converter
Convert a color to HEX, RGB, HSL, HSB, and CMYK at once.
HEX to RGB
Convert HEX color codes to RGB / RGBA values.
RGB to HEX
Convert RGB values into HEX color codes.
CSS Box Shadow Generator
Visually design CSS box-shadow with a live preview and code.
CSS Border Radius Generator
Visually craft border-radius with a live preview.
HEX to CMYK
Convert HEX colors to CMYK print values.
CMYK to HEX
Convert CMYK print values to HEX colors.
HEX to HSB
Convert HEX colors to HSB / HSV values.