The text-align-last property sets how the last line of a block is aligned — or the line right before a forced line break. Other lines still follow text-align.
It is most useful with text-align: justify, where full lines stretch to both edges but the final line often should stay start-aligned, centered, or otherwise finished cleanly. It is inherited. The initial value is auto.
Baseline · Widely available.
Not deprecated. Cross-browser since about September 2022 (Safari 16+ completed support). Safe for modern sites.
Justify tip.
Pair text-align: justify with text-align-last: left (or start) so the last line does not look stretched.
Syntax
CSS Syntax
syntax.css
text-align-last:auto | start | end | left | right | center | justify | initial | inherit;
One keyword. auto follows text-align, except when text-align is justify — then auto acts like start.
Values
Property Values
Value
Description
Try it
auto
Follows text-align; with justify, behaves like start
Justified text looks even across full lines. The last short line stays left instead of stretching.
How It Works
Keep justify for body lines. Full lines still meet both edges.
Finish left.text-align-last: left parks the final line on the left.
Close to auto. With justify, auto already acts like start — left is the physical LTR form.
Readable ending. Avoids large gaps on a short last line.
Example 3 — Logical Start
Use start so the last line follows writing direction.
CSS
<style>
p {
text-align: justify;
text-align-last: start;
}
</style>
<p>Last line aligns to the start edge.</p>
<p dir="rtl">السطر الأخير يتبع اتجاه الكتابة.</p>
Last line aligns to the start edge in this justified paragraph.
نص مبرر يظهر كيف يتبع السطر الأخير اتجاه الكتابة من اليمين.
How It Works
Logical keyword.start means the beginning of the inline direction.
LTR looks like left. In English, start matches the left edge.
RTL flips. With dir="rtl", start matches the right edge.
Better than hard-coded left. One rule works for both directions.
Edge Cases & Pitfalls
If the last line does not change, one of these is usually why.
auto
auto + justify means start
When text-align is justify, text-align-last: auto behaves like start — not like justify.
single
One short line looks like text-align
If the block is only one line, that line is also the last line, so text-align-last and text-align can look the same.
forced
Also applies before forced breaks
A line before a forced break (for example from <br>) is treated like a last line for this property.
justify
Justifying the last line can look sparse
text-align-last: justify stretches a short final line. Prefer start or left for readability in most paragraphs.
inherit
It is inherited
A parent value can affect nested blocks. Set a local value when a child needs different last-line behavior.
Compatibility
Browser Support
text-align-last is a browser CSS property for last-line alignment. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
text-align-last
Chrome 47+, Firefox 49+, Safari 16+, Edge 79+. Widely available since September 2022. Older IE had only partial support.
97%Browser support
Google Chrome47+
Full support
Mozilla Firefox49+
Full support
Apple Safari16+
Full support
Microsoft Edge79+
Full support
Opera34+
Full support
Samsung Internet5+
Full support
Internet ExplorerPartial
Partial support
text-align-lastWidely supported
Bottom line: Safe for modern sites. Safari before 16 lacked support, so that release date defines Baseline. It is not a runtime API.
Remember
Key Takeaways
Role: align only the last line (or the line before a forced break).
Best with justify: finish the last line with left, start, or center.
auto rule: follows text-align, except justify → start.
Logical options: use start/end when LTR and RTL both matter.
One line:text-align-last controls the last line — pair it with text-align: justify for clean endings.
Frequently Asked Questions
It sets how the last line of a block is aligned, or the line right before a forced line break. Other lines still follow text-align.
The default is auto. The last line follows text-align, except when text-align is justify — then auto behaves like start.
text-align controls every line. text-align-last overrides only the final line (or the line before a forced break).
Justified paragraphs often leave the last line looking odd if it is forced to stretch. text-align-last lets you left-align, center, or otherwise finish that line cleanly.
Yes. It is inherited, so a value on a parent can affect nested block containers unless they set their own value.
It is Baseline and widely available since about September 2022 (Chrome 47+, Firefox 49+, Safari 16+). It is a browser CSS property, not a Node.js feature.