Skiptingar
Icelandic text, set well.
Correct Icelandic hyphenation and typographic rules for the web.
Kjörsókn í Hrafnafjarðarbyggð aldrei meiri í sveitarstjórnarkosningum
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. "Þetta er söguleg niðurstaða," sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, kl. 14.30 daginn eftir.
Kjörsókn í Hrafnafjarðarbyggð aldrei meiri í sveitarstjórnarkosningum
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. „Þetta er söguleg niðurstaða,“ sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, kl. 14.30 daginn eftir.
- 23.139letter patterns from the 2020 Árni Magnússon list mark where a word may break. There is no dictionary, so new and rare compounds break well too.
- 36words marked by hand: a few the patterns break wrongly or not at all, and compounds whose joints titles should break at. Your own words go in a dictionary option.
- 0 kBof JavaScript to hyphenate. The server puts the soft hyphens in, so every browser gets the same places to break.
Try it
Write your own text, change the measure and the rules, and see where it breaks.
Kjörsókn í Hrafnafjarðarbyggð aldrei meiri í sveitarstjórnarkosningum
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. Á árunum 1990–2010 var hún að jafnaði um 78%. „Þetta er söguleg niðurstaða,“ sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, á blaðamannafundi kl. 14.30 daginn eftir.
Landssamtök ungra kjósenda (LUKA) fylgdust með framkvæmdinni. Í skýrslu þeirra, á bls. 12, kemur fram að kosningaþátttaka ungs fólks hafi aukist mest. Nánari upplýsingar eru á www.example.is og fyrirspurnir má senda á kosningar@example.is eða í síma 555‑1234.
A soft hyphen (U+00AD) is an invisible character. It shows a hyphen only when the line breaks right there.A no-break space (U+00A0) looks like a space but keeps the words on both sides of it on one line.
Where Icelandic breaks
Long compound words break at their joints. Patterns come first, then compound knowledge, then exceptions.
Not built yet.
Where Icelandic doesn’t break
Good line breaking also means knowing where not to break.
unitsPuts a no-break space between a number and its unit, so 1.000 kr. and 5 km never split across two lines.
Verð 1.000 kr. og 5 km leið í 20 °C hita.
Verð 1.000 kr. og 5 km leið í 20 °C hita.
datesKeeps a month and the year after it together, so sep. 2026 and sept. 2027 never split.
Opnað 30. sep. 2026 og lokað í sept. 2027.
Opnað 30. sep. 2026 og lokað í sept. 2027.
ordinalsKeeps a number with a full stop, like 1. or 30., on the same line as the lowercase word after it.
Hún lenti í 1. sæti í 2. umferð.
Hún lenti í 1. sæti í 2. umferð.
prefixesKeeps an abbreviation with the number that follows it, so nr. 5, bls. 12 or kl. 14.30 never split across lines. Standard abbreviations like t.d. and o.s.frv. have no spaces, so they never break.
Sjá bls. 12, nr. 5 og kl. 14.30.
Sjá bls. 12, nr. 5 og kl. 14.30.
numbersKennitala and phone numbers never split across lines: the hyphen becomes a non-breaking hyphen (U+2011) and the spaces become no-break spaces. CleanCopy puts a normal hyphen back when you copy.
Kennitala 010190-2939, sími 555-1234 eða +354 555 1234.
Kennitala 010190‑2939, sími 555‑1234 eða +354 555 1234.
titlesKeeps dr., sr., próf. and hr. on the same line as the capitalised name after them.
Fundur með dr. Jóni og sr. Önnu.
Fundur með dr. Jóni og sr. Önnu.
singleLetterPuts a no-break space after a one-letter word, so it never ends a line alone. Off by default, so this row turns it on.
Hún á hest og býr í Kópavogi.
Hún á hest og býr í Kópavogi.
lastWordsPuts a no-break space between the last two words of the text, so the last line is never a single word. Off by default, so this row turns it on. text-pretty does this better where the browser supports it, so use this rule only as a fallback for Firefox and Safari before 26, which do not support it.
Þau fóru saman til Akureyrar
Þau fóru saman til Akureyrar
Icelandic punctuation
Quotes, dashes and the other Icelandic conventions, shown before and after.
quotesStraight double quotes become Icelandic „…“. A paired 'word' becomes ‚word‘, the mark for a word’s meaning (Ritreglur §28.2). A quote inside a quote uses „…“ again: type it that way (§28.1).
Hann sagði "komdu heim" og orðið fákur merkir 'hestur'.
Hann sagði „komdu heim“ og orðið fákur merkir ‚hestur‘.
dashesSwaps the hyphen in a number range, and a spaced hyphen, for an en dash. Off by default, so this row turns it on.
Árin 1990-2000 var veturinn - og þá sérstaklega febrúar - óvenju mildur.
Árin 1990–2000 var veturinn – og þá sérstaklega febrúar – óvenju mildur.
Real interfaces
Actual interface problems, such as a heading at phone width, rather than isolated linguistic examples.
Heading, phone width
Without the package a long compound runs out of the box. With it the word breaks at a joint, and text-wrap: balance evens out the lines. Why, with and without
Vaðlaheiðarvegavinnuverkfærageymsluskúr
Hraðbrautarframkvæmdir á landsbyggðinni
Vaðlaheiðarvegavinnuverkfærageymsluskúr
Hraðbrautarframkvæmdir á landsbyggðinni
Card grid
Narrow cards with long names. Without the package the names run out of the cards.
Heilbrigðisráðuneytið
Heilbrigðisþjónusta um allt land.
Grunnskólakennarar
Kennsla og skólastarf.
Náttúruverndarsvæði
Friðlönd og þjóðgarðar.
Ferðaþjónustufyrirtæki
Ferðir og afþreying.
Sveitarstjórnarkosningar
Kosið var 16. maí 2026.
Hæstaréttarlögmaður
Málflutningur fyrir dómstólum.
Heilbrigðisráðuneytið
Heilbrigðisþjónusta um allt land.
Grunnskólakennarar
Kennsla og skólastarf.
Náttúruverndarsvæði
Friðlönd og þjóðgarðar.
Ferðaþjónustufyrirtæki
Ferðir og afþreying.
Sveitarstjórnarkosningar
Kosið var 16. maí 2026.
Hæstaréttarlögmaður
Málflutningur fyrir dómstólum.
Mixed languages
The two English phrases sit in <span lang="en">. The · marks show the result: the Icelandic words get breaks and „…“ quotes, the English ones are left as they are.
Enska orðið internationalization og til
Sizes
The first paragraph of your text at three sizes, in the same measure. Smaller type fits more letters on a line, so the breaks land in different places.
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. Á árunum 1990–2010 var hún að jafnaði um 78%. „Þetta er söguleg niðurstaða,“ sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, á blaðamannafundi kl. 14.30 daginn eftir.
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. Á árunum 1990–2010 var hún að jafnaði um 78%. „Þetta er söguleg niðurstaða,“ sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, á blaðamannafundi kl. 14.30 daginn eftir.
Same text, every browser
Skiptingar determines where text may break. The browser determines whether it needs to.
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. Á árunum 1990-2010 var hún að jafnaði um 78%. "Þetta er söguleg niðurstaða," sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, á blaðamannafundi kl. 14.30 daginn eftir.
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. Á árunum 1990-2010 var hún að jafnaði um 78%. "Þetta er söguleg niðurstaða," sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, á blaðamannafundi kl. 14.30 daginn eftir.
Kjörsókn í sveitarstjórnarkosningunum 16. maí 2026 var sú mesta sem mælst hefur í Hrafnafjarðarbyggð, 91,4%. Á árunum 1990–2010 var hún að jafnaði um 78%. „Þetta er söguleg niðurstaða,“ sagði dr. Guðrún Sigurðardóttir, formaður yfirkjörstjórnar, á blaðamannafundi kl. 14.30 daginn eftir.
How it works
A word goes through patterns and rules, and comes out as HTML with soft hyphens in it. The browser sets the line.
1Word
On the serverþjóðfélagsumræðaAny Icelandic word. There is no dictionary to look it up in.
2Patterns
On the serverþ2j2ó2ð1fé1lags1u2m1ræðaEach slot takes the highest digit of any pattern that covers it. Odd allows a break, even forbids one.
3Rules
On the serverþjóðfé lags um ræða The typographic rules keep the breaks with room on both sides and drop the one before a linking syllable. The exception list marks a few words by hand.
4HTML
On the serverþjóð­fé­lags­um­ræðaAn invisible soft hyphen at each break. The page ships no code to put them there.
5Line
In the browserNý þjóðfélagsumræða hafin
The browser picks the break that fits, and draws the hyphen only there.
- 1
Patterns
This is Franklin Liang’s algorithm from 1983, the one TeX uses. There is no dictionary. 23.139 short letter patterns carry numbers between the letters, like
.af4lið.(the dots mark the start and end of the word). An odd number allows a break, an even number forbids one, and the highest number at each spot wins. The patterns are the 2020 Icelandic list from the Árni Magnússon Institute (CC BY 4.0). It gets compound joints right: þjóð-fé-lags-um-ræða, where the older TeX patterns gave þjóð-fé-lagsum-ræða. - 2
Exceptions
A hand-checked list in
data/exceptions.txt(CC0) overrides the patterns for the words on it: a few they break wrongly, and compounds marked for their joints. A-marks a break and a=marks a compound joint. In heading mode a word breaks only at its joints, when one fits: listed ones, and two rules for the rest. A break before a linking syllable such as ar is dropped, so stjórnar-völd, not stjórn-ar-völd, and the break kept after it is a joint. So is a name ending such as -dóttir. - 3
Presets
typographicis the default and keeps only the breaks that look good.ritreglurallows every break the patterns allow, close to what the official spelling rules allow, such as ó-lán, with 1 letter before and 2 after, in words of 4 or more letters (Skiptingar’s own limit). Typographic keeps only some of those breaks. - 4
Soft hyphens, on the server
hyphenate()inserts a soft hyphen (U+00AD) at each allowed break while the page renders, in a React Server Component called<Hyphenate>. The browser gets plain HTML, so a page that only uses it ships 0 kB of hyphenation code, and the places to break are the same in every browser. The browser still picks which break to use on each line. CSStext-wrap: prettyandbalancehelp it choose well. - 5
Typesetting
typeset()only swaps one character for another. Spaces become no-break spaces in 1.000 kr., 30. september, bls. 12 and dr. Jón, and straight quotes become Icelandic „…“. Apart from putting the text in NFC it never changes its length, so it can run across a whole JSX tree at once and pair quotes across inline elements such as<strong>. One rule,lastWords, keeps the last line from being a single word.text-prettydoes that better where the browser supports it, so uselastWordsonly as a fallback for Firefox and Safari before 26, which do not supporttext-pretty. - 6
Safety
URLs, email addresses and domains are never touched. Running either function twice gives the same result.
<CleanCopy />removes the soft hyphens and no-break spaces from copied text. Text that only exists in the browser can use the lazy client entry,useHyphenate, 48.9 kB brotli, loaded on first use, or none at all when it asks your server. - 7
Languages, names and numbers
<Hyphenate>leaves text inside it under a non-Icelandiclangalone, with no Icelandic hyphenation and no Icelandic quotes, and a nestedlang="is"turns it back on; a page in another language passes its own lang prop. Input is turned into NFC first, so decomposed letters, like those in macOS file names, still hyphenate. All-caps words of 4 to 8 letters, such as UNESCO, never break. In heading mode a capitalised name breaks at its ending’s joint when one fits, as in Sigurðar-dóttir. Kennitala and phone numbers stay on one line, and CleanCopy puts the normal hyphen back on copy.
import { Hyphenate } from "skiptingar/react";
<Hyphenate mode="heading">
<h1>Sveitarstjórnarkosningar á landsbyggðinni</h1>
</Hyphenate>Result
The real output for the heading above. Each · is a soft hyphen.
Sveitar
CSS it pairs with
Skiptingar only decides where a word may break. These properties decide how the browser uses those breaks. Each pair sets the same text at the same width, without and with the property. Drag the width: at some widths the two agree, at others they part.
text-wrap: pretty
Stops a paragraph from ending on one short word. Safari 26 and later also even out the ragged right edge; Chrome only adjusts the last few lines.
- Used here
- The paragraphs in Real interfaces, the steps on this page and the body text in Try it.
- Support
- Chrome 117+ and Safari 26+ support it. Firefox does not, and falls back to normal wrapping. The typeset rule
lastWordsdoes part of the same job, but only for the last two words, so use it as a fallback for Firefox and older Safari.
text-wrap: wrapAlþingi og forseti Íslands fara saman með löggjafarvaldið. Forseti og önnur stjórnarvöld samkvæmt stjórnarskrá þessari og öðrum landslögum fara með framkvæmdarvaldið. Dómendur fara með dómsvaldið.
text-wrap: prettyAlþingi og forseti Íslands fara saman með löggjafarvaldið. Forseti og önnur stjórnarvöld samkvæmt stjórnarskrá þessari og öðrum landslögum fara með framkvæmdarvaldið. Dómendur fara með dómsvaldið.
text-wrap: balance
Evens out the line lengths of a short block, so a heading of two or three lines does not end on one word.
- Used here
- The section titles, the titles in Try it and the heading samples.
text-wrap: wrapNýr vegur opnaður á milli bæjanna
text-wrap: balanceNýr vegur opnaður á milli bæjanna
hyphens: manual and auto
manual, the CSS default, adds a hyphen only where there is a soft hyphen, and those are the ones Skiptingar puts in. auto asks the browser’s own dictionary. Only Firefox ships an Icelandic one; Chrome, Edge and Safari do not. Test it in Same text, every browser.
- Used here
- Every hyphenated text on this page uses manual. The Browser column in Same text, every browser uses auto on purpose.
hyphens: autoAlþingi og forseti Íslands fara saman með löggjafarvaldið. Forseti og önnur stjórnarvöld samkvæmt stjórnarskrá þessari og öðrum landslögum fara með framkvæmdarvaldið. Dómendur fara með dómsvaldið.
hyphens: manual, with SkiptingarAlþingi og forseti Íslands fara saman með löggjafarvaldið. Forseti og önnur stjórnarvöld samkvæmt stjórnarskrá þessari og öðrum landslögum fara með framkvæmdarvaldið. Dómendur fara með dómsvaldið.
lang
Tells screen readers which language to speak and tells the browser which language rules to use. hyphens: auto needs it.
- Used here
- Every Icelandic container on this page. The English interface text has none.
<p lang="is">Hraðbrautarframkvæmdir</p>Install
Three entry points: the JavaScript API, the React components and the client-side API.
Not published yet. The name is reserved on npm at version 0.0.0, which holds no code. This is how installing will work.
A first page
Wrap the text in <Hyphenate> where the page renders on the server, and add <CleanCopy /> once, so text copied from the page has no soft hyphens in it.
import { Hyphenate } from "skiptingar/react";
import { CleanCopy } from "skiptingar/client";
export default function Page() {
return (
<main lang="is">
<CleanCopy />
<Hyphenate>
<h1>Sveitarstjórnarkosningar á landsbyggðinni</h1>
<p>Verð 1.000 kr. frá 30. september.</p>
</Hyphenate>
</main>
);
}Entry points
Import only what the page needs. The first two run on the server and send nothing to the browser.
skiptingarAnywhere: Node, the edge, a build stephyphenate(),typeset()andprocessSegments(): plain functions on strings.skiptingar/reactReact Server Components<Hyphenate>and<Typeset>, which change only the text in the JSX you give them.skiptingar/clientThe browseruseHyphenate()for text that only exists in the browser (it can ask your server instead of loading the patterns), and<CleanCopy />. The hyphenation core loads on first use, 48.9 kB brotli.
No runtime dependencies. React 19 is needed only for skiptingar/react and skiptingar/client. MIT licence; the exception list is CC0; the hyphenation patterns are CC BY 4.0, so keep their credit.
What it costs a browser
What a page downloads for each job, with Skiptingar and with the common alternatives. Most of Skiptingar runs on the server and sends nothing. Text that only exists in the browser can be sent to your server to hyphenate, so the patterns never download; this page does that.
Hyphenate Icelandic
- Skiptingar on the serversoft hyphens in the HTMLHyphenated while the page renders.0 kB
- Skiptingar via your serversoft hyphens from your serveruseHyphenate with an endpoint: the browser sends the text and gets it back hyphenated.4.6 kB
- hyphen/issoft hyphens added in the browserThe old TeX patterns.12.9 kB
- Hyphenopolysoft hyphens added in the browserThe old TeX patterns as WebAssembly, loaded where the browser cannot hyphenate.14.8 kB
- Skiptingar in the browsersoft hyphens added in the browserThe 2020 data, loaded on first use, for a page with no server to ask. Larger than the old patterns because it breaks better.53.5 kB
Typesetting rules
- Skiptingar on the servercharacters swapped in the HTMLIcelandic numbers, dates, abbreviations and quotes.0 kB
- Typeset.jsrewrites the markupEnglish rules, run in the browser here.29.7 kB
Measured on 1 October 2026: each package bundled with a minimal use, minified, React left out, brotli. Each row is what that setup downloads for its job alone, so the scope differs: some sizes include hyphenation, some leave it to the server.
Planned
What comes before the first release and what can wait. Nothing here is promised yet.
Beta and v1
On npm
The three entry points as one ESM package with its types, no runtime dependencies and a changelog.
Report a wrong break
A prefilled GitHub issue from the break editor that holds the line to add to the exception list, and the list public, so anyone can see what has been fixed. Until a fix ships, the dictionary option takes your own words.
Fix the remaining bad breaks
The linking-syllable rule fixed stjórnar-völd and fornaldar-frægð. Next are the words where the patterns disagree with the word list they were made from.
This page as the documentation
Every option shown live, with the API reference beside it.
Later
Markdown and HTML
A rehype plugin and a small CLI that hyphenate and typeset, for sites that are not built with React.
Smaller patterns, maybe
Train a smaller pattern set from the same 218.000-word list, trading a little accuracy for size, for pages that must hyphenate in the browser without a server. Only if the size turns out to matter.
Reference
Pattern sources, licences, browser support, bundle sizes and methodology.
Scroll the table sideways for the 2020 column.
| Word | TeX hyphen/is | 2020 Árni Magnússon |
|---|---|---|
| þjóðfélagsumræða | þjóð-fé-lagsum-ræða | þjóð-fé-lags-um-ræða |
| hraðbrautarframkvæmdir | hrað-brautar-fram-kvæmd-ir | hrað-braut-ar-fram-kvæmd-ir |
| ólán | ólán | ó-lán |
| íþróttafélagið | íþrótta-fé-lag-ið | í-þrótta-fé-lag-ið |
| óhjákvæmilegt | óhjá-kvæmi-legt | ó-hjá-kvæmi-legt |
| Vaðlaheiðarvegavinnuverkfærageymsluskúr | Vaðla-heið-ar-vega-vinnu-verk-færa-geymslu-skúr | (same) |
TeX here uses its usual limit of 2 letters before a break, the 2020 data its own limit of 1, so ó-lán and í-þrótta show only in the 2020 column. The joint in þjóðfélags-umræða is the 2020 data’s own fix. The typographic preset drops one-letter breaks.
Reading
- Better typography with text-wrap: prettyWebKit blog
What makes a ragged edge look good: no short last line, an even right edge, hyphens where they help. It shows how Safari weighs these, with a live demo that draws the plain text faintly behind the improved one.
- CSS text-wrap: prettyChrome for Developers
Chrome’s take on the same property. It keeps a paragraph from ending on one word, and near the end it adjusts hyphenation and earlier lines to make room. That is why its effect shows at some widths and not at others.
- CSS text-wrap: balanceChrome for Developers
When to balance a title, and the catch: browsers only balance blocks of a few lines, so it is for titles and captions, not paragraphs.
- HyphenationButterick’s Practical Typography
A counterpoint worth reading: in ragged text hyphenation is optional, and headings are better without it. The typographic rules and heading mode take the same view, breaking less often, and in a title only long words.
- Word Hy-phen-a-tion by Com-put-erFrank Liang, 1983
The thesis behind the patterns Skiptingar runs, and the reason it needs no dictionary.
- § 33 OrðskiptingRitreglur, Árnastofnun
The official rules for breaking Icelandic words between lines. The Ritreglur preset follows them through the patterns, which miss a few breaks and allow a few they forbid; the typographic preset is stricter.
Works well with
Hangs an opening „ outside the text’s edge, so a line that starts with a quote still lines up. Few browsers support it, and the rest ignore it, so it is safe to add.
- TypesetDavid Merfield
A server-side HTML pre-processor for hanging punctuation, optical margin alignment and small caps. It has its own quotes and hyphenation: turn off
quotesandhyphenateand let Skiptingar do those for Icelandic. - HyphenopolyMathias Nater
Hyphenation for many languages, in the browser or Node. It has Icelandic too, from the older TeX patterns. Skiptingar leaves text under another
langalone, so the two can share a page. - Icelandic hyphenationYlhýra
A neural model that finds compound joints. A second opinion when you check a break before adding it to the exception list.
- GreynirCorrectMiðeind
Spelling and grammar checking for Icelandic, in Python. Correct the text first, then set it.
Icelandic on the platform
Some things the browser does for Icelandic and some it does not. These notes say what to use instead of writing it yourself.
Dates and numbers
Chrome and Edge on the desktop ship no Icelandic Intl data. Tested in Chrome 154 on macOS: dates render in English, and
Intl.Collator("is")sorts æ next to a and ö with o, and á, é and í as plain a, e and i. Node, Bun, Firefox and Safari are fine. Format dates and numbers on the server, and for sorting in the browser use cldr-is (on GitHub, not on npm yet).Plurals
Intl.PluralRules("is")works everywhere. It treats 21, 31 and 101 as singular, as Icelandic does.Slugs
slugify (the npm package) already maps þ to th, ð to d, æ to ae and ö to o, the ÍST 130 table.
Names in a sentence
Forms like til Jóns and Jóni need declension. Use beygla.
Kennitala
Format it, but do not validate the check digit. Þjóðskrá stopped using it for new numbers on 18 February 2026. See kennitölur án vartölu.
Phone numbers
555-1234 and 555 1234 are kept together by typeset(). Browsers otherwise break after the hyphen.