Accent borders, asymmetric inline padding, and text alignment mirror automatically when switching document direction.
CSS Physical → Logical Properties Converter
Convert physical directional CSS properties, asymmetric shorthands, and inline HTML styles into RTL-ready CSS logical properties locally in the browser.
100% client-side: Your files never leave your browser.
How Logical CSS Flips Automatically with dir="ltr"
This sample card uses a single set of logical CSS rules — toggle direction to inspect how the accent border, asymmetric padding, corner radius, badge alignment, and button placement mirror with zero duplicate rules.
Active logical properties: border-inline-start · padding-inline-start / padding-inline-end · border-start-start-radius · margin-inline-start: auto · text-align: start
Physical vs. Logical CSS Cheat Sheet
Physical CSS rules pin spacing, borders, and alignment to the left or right edge of the viewport. When a page switches to dir="rtl" for Arabic, Hebrew, Persian, or Urdu, physical rules remain fixed on the wrong side. CSS logical properties tie layout to the inline reading axis instead, mirroring automatically without maintaining duplicate stylesheets. This utility complements HTML Translate alongside the practical guides on translating HTML without breaking layout and translating an HTML landing page.
| Physical CSS | Logical CSS | RTL Behavior |
|---|---|---|
margin-left / margin-right | margin-inline-start / margin-inline-end | Mirrors outer horizontal spacing under dir="rtl". |
padding-left / padding-right | padding-inline-start / padding-inline-end | Flips inner horizontal spacing along the reading direction. |
border-left / border-right | border-inline-start / border-inline-end | Moves accent borders and dividers to the start or end edge. |
border-top-left-radius / border-top-right-radius | border-start-start-radius / border-start-end-radius | Mirrors top corner rounding in RTL layouts. |
border-bottom-left-radius / border-bottom-right-radius | border-end-start-radius / border-end-end-radius | Mirrors bottom corner rounding in RTL layouts. |
left / right | inset-inline-start / inset-inline-end | Flips positioned offsets for badges, drawers, and icons. |
text-align: left / right | text-align: start / end | Aligns text with the active document writing direction. |
float: left / right (clear) | float: inline-start / inline-end | Floats badges and inline elements relative to reading flow. |
Why Asymmetric Shorthands Matter in RTL
Four-value margin and padding shorthands always follow physical top, right, bottom, left order. When the left and right values differ, the extra offset stays on the wrong side in RTL pages. Expanding asymmetric declarations into padding-block and padding-inline flips the horizontal offset automatically while leaving symmetric rules such as padding: 12px 20px; untouched.
/* Before (physical 4-value shorthand) */
.card {
padding: 10px 24px 10px 8px;
}
/* After (logical block + inline shorthands) */
.card {
padding-block: 10px;
padding-inline: 8px 24px;
}In padding-inline, the first value maps to inline-start (physical left in LTR) and the second maps to inline-end (physical right in LTR).
FAQ
Which browsers support CSS Logical Properties?
All current versions of Chrome, Firefox, Safari, and Edge support inline and block margin, padding, border, inset, border-radius, and text-align logical properties, covering over 97% of global browser usage.
How does dir="rtl" interact with margin-inline-start?
In left-to-right pages, margin-inline-start applies to the left edge. Setting dir="rtl" on the html element or a container automatically maps margin-inline-start to the right edge without separate RTL stylesheets.
Why does transform: translateX() still need a manual RTL override?
CSS transforms operate on physical X and Y coordinates rather than writing direction. Horizontal shifts such as translateX(-4px) require a [dir="rtl"] or :dir(rtl) rule that reverses the sign.
Can CSS Logical Properties be used in HTML emails?
Email client support remains inconsistent. Desktop Outlook on Windows and several Gmail apps ignore logical spacing and inset properties, so production HTML emails still require physical properties or dedicated RTL layouts.
Does this converter upload CSS or HTML files to a server?
No. All parsing, conversion, copy, and download actions run locally inside the browser tab. Pasted stylesheets and dropped files never leave the device.
Explore additional browser-side localization utilities in the tools hub.