<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh" -->

---
title: justif — publication-grade text justification for the web
description: justif is a JavaScript library for achieving publication-grade text justification on the web, bringing typographic quality closer to print standards for web...
canonical: https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: justif — publication-grade text justification for the web | daily.dev
og:description: justif is a JavaScript library for achieving publication-grade text justification on the web, bringing typographic quality closer to print standards for web...
og:url: https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh
og:image: https://api.daily.dev/og/posts/ebR7Lk8Uh.png
og:image:alt: justif — publication-grade text justification for the web
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# justif — publication-grade text justification for the web

**[Hacker News](https://daily.dev/sources/hn)** · 2 min read · 0 upvotes · 0 comments

## Summary

justif is a JavaScript library for achieving publication-grade text justification on the web, bringing typographic quality closer to print standards for web content.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://justif.lyall.co/>

## Community take

How the wider developer community reacted, aggregated from 3 discussions and 94 comments across hackernews, lobsters (as of 2026-07-23).

**TL;DR:** The community is overwhelmingly impressed by justif, a JavaScript library bringing Knuth-Plass paragraph justification (plus tracking, expansion, and hyphenation) to the web; the main side debate on Lobsters is whether the vibecoding tag is appropriate given the author's admitted LLM use.

**Sentiment:** 75% positive · 20% mixed · 5% skeptical

**The case for**

- The visual output looks like professional typesetting rather than CSS, with real-world users reporting dramatic improvements on narrow multi-column layouts.
- It ships with TeX hyphenation dictionaries and supports custom dictionaries, making it useful for archaic or specialized text.
- Performance is solid — a ~5k-word essay justified in ~280ms at ~36KB gzipped — and the author is actively responsive to feature requests (e.g., drop cap support added same day).
- The interactive demo with side-by-side and flicker comparison modes makes the quality difference immediately obvious.

**The pushback**

- The demo uses artificially narrow line widths that exaggerate the improvement over standard browser rendering.
- LLM-assisted ("vibecoded") authorship raised concerns on Lobsters about code quality and tagging practices.
- Drop caps (floated initial letters) currently trip the layout engine, causing overflow.
- No subresource integrity hash was included in the example CDN script tag (though the author fixed this promptly).
- The Knuth-Plass algorithm is quadratic-time, which could be a concern for very long single paragraphs.

**By community**

- hackernews (positive): Highly enthusiastic reception with detailed technical engagement, real-world adoption reports, and active back-and-forth with the author on hyphenation, performance, and edge cases.
- lobsters (mixed): Technically positive about the library itself, but a notable sub-thread debates whether the vibecoding tag is a witch hunt and whether browser-native solutions should make this unnecessary.

**Hottest debate:** Whether tagging the project as 'vibecoding' on Lobsters is a fair characterization or an unfair dismissal of a genuinely useful library.

**Open questions**

- Will browsers ever natively implement full Knuth-Plass justification (with tracking and expansion) so libraries like this become unnecessary?
- How does justif handle very long single paragraphs where the quadratic-time algorithm could become a bottleneck?
- Is there a path to supporting non-rectangular text flow (e.g., wrapping around floated images) within justif?
- Can justif coexist gracefully with `text-wrap: pretty` as browser support matures?

**Highlights**

> Follow-up, since I asked the questions above: I spent the evening running Justif against the hardest page I have: three 356px columns of 18th-century text set in IM Fell at ~17.6px with 24.3px leading. I came in curious and left planning the integration. The numbers were better than I hoped. A full ~5k-word essay justified in about 280ms, and ~36KB gzipped including the en-US patterns. And the output is the part that sold me. The columns look like typesetting rather than CSS, which is the whole thing I'd been grumbling about. The only snag I hit: a floated initial letter (drop cap) trips it — the first line ignores the float and overflows the gutter. Excluding that paragraph and leaving it on native justify renders perfectly, so it's cosmetic to work around, but a first-class exclusion selector would be lovely. I'll file an issue with the details and our measurements. Best part: this experiment exposed that our sheets are currently set ragged right, which no printer in 1787 would have tolerated. Your library may be what finally makes us historically honest. Test page for context: federalistreader.org/papers/10/ Thank you for building this!
> — [vhwalke on hackernews](https://news.ycombinator.com/item?id=48999370)

> The layout is done entirely in DOM. The layout engine calculates the line breaks, tracking, expansion, etc. then applies the layout using HTML spans with the appropriate attributes applied. There’s generally one span per line, but that can change for more complicated lines! I invite you to inspect the demo page in your browser’s dev console if you’re particularly curious. And yes, I did use LLMs for the implementation, both Fable 5 and 5.6 Sol specifically. I would not have been able to achieve anywhere close to the current result unaided. My patience and expertise would’ve been exhausted long before getting anywhere especially interesting. My philosophy with LLMs is to try to use them to achieve levels of quality and polish that would’ve been previously unreasonable. I hope this project is a demonstration of that.
> — [lyall on hackernews · 1 comments](https://news.ycombinator.com/item?id=49002419)

> Lobster-1: "Hey, they developed a drug that cures cancer!" Lobster-2: "Yeah… but they used AlphaFold, CRISPR and ...(drumroll)... Fable." Lobster-1: "OMG! that’s unacceptable. For the sake of human kind lets just throw everything away and go back to spending 40 years manually drawing proteins with colored pencils on a board!!!!!"
> — [atmosx on lobsters · 3 points](https://lobste.rs/s/p1jpv1/justif_knuth_plass_justification#c_r0ak9e)

> There’s a real implementation of `pretty` in Safari these days, but it is buggy in combination with `justify`: https://matklad.github.io/2026/02/14/justifying-text-wrap-pretty.html
> — [matklad on lobsters · 3 points, 1 comments](https://lobste.rs/s/p1jpv1/justif_knuth_plass_justification#c_4u4ynq)

> Implemented on https://federalistreader.org ... made a big difference!  You can see the comparison here: https://federalistreader.org/notes/justif/ Nicely done!  (and thanks for the fixes with v0.5.0.  I submitted a couple more.)
> — [vhwalke on hackernews](https://news.ycombinator.com/item?id=49009977)

**Source threads**

- [hackernews](https://news.ycombinator.com/item?id=48946738) · 190 points · 79 comments
- [lobsters](https://lobste.rs/s/p1jpv1/justif_knuth_plass_justification) · 50 points · 15 comments
- [hackernews](https://news.ycombinator.com/item?id=48941987) · 4 points · 0 comments

## Similar posts on daily.dev

- [Governing Security in the Age of Infinite Signal](https://daily.dev/posts/governing-security-in-the-age-of-infinite-signal-qhihbir44) · Snyk · 0 upvotes · 0 comments
- [No one has a good plan for how AI companies should work with the government](https://daily.dev/posts/no-one-has-a-good-plan-for-how-ai-companies-should-work-with-the-government-nkajqoze1) · TechCrunch · 0 upvotes · 1 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#css](https://daily.dev/tags/css), [#typography](https://daily.dev/tags/typography)

[View this post on daily.dev](https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"justif — publication-grade text justification for the web","url":"https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh"},"datePublished":"2026-07-21T23:16:19.509Z","dateModified":"2026-07-23T17:26:28.875Z","description":"justif is a JavaScript library for achieving publication-grade text justification on the web, bringing typographic quality closer to print standards for web...","image":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","thumbnailUrl":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/justif-publication-grade-text-justification-for-the-web-ebr7lk8uh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,css,typography","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"justif — publication-grade text justification for the web"}]}
```

