The basics
What is an FB2 file?
FictionBook was created by Dmitry Gribov and other Russian developers and first released in 2004. Its idea is to describe what a book is made of (chapters, titles, epigraphs, poems, citations, notes) rather than how it should look, so that one file can be shown well on any screen and converted automatically to other formats.
It became the main format of the large Russian-language e-libraries and is very popular in the Russian-speaking world. E-readers such as PocketBook's read it out of the box; Amazon's Kindle doesn't.
- One file, plain XML. Text, metadata and images all live in a single document you can open in a text editor.
- Structure, not layout. There are no stylesheets in practice and no fixed pages. The reading app chooses fonts, sizes and margins.
- Rich metadata. Authors are split into first, middle and last names, genres come from a fixed list, and series, translators and the printed edition each have their own fields, which suits large catalogues.
Anatomy
What's inside an FB2 file
An FB2 file is one XML document with up to four kinds of top-level elements: a description, one or more bodies, and binary data. Here is our sample-book.fb2, shortened, part by part.
<?xml version="1.0" encoding="UTF-8"?>
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0"
xmlns:l="http://www.w3.org/1999/xlink">
<description>
<title-info>
<genre>home_crafts</genre>
<author><first-name>Ada</first-name><last-name>Example</last-name></author>
<book-title>A Small Guide to Paper Boats</book-title>
<annotation><p>A free sample e-book from 99helpers.com/file-types/fb2. …</p></annotation>
<coverpage><image l:href="#cover.jpg"/></coverpage>
<lang>en</lang>
</title-info>
<document-info>
<author><first-name>Ada</first-name><last-name>Example</last-name></author>
<date value="2026-10-27">27 October 2026</date>
<id>99helpers-sample-fb2-paper-boats</id>
<version>1.0</version>
</document-info>
</description>
<body>
<title><p>A Small Guide to Paper Boats</p></title>
<epigraph><p>Every boat starts as a flat page.</p></epigraph>
<section id="ch1">
<title><p>Chapter 1. Choosing the paper</p></title>
<p>Almost any rectangle of paper will make a boat, …</p>
<subtitle>The shape of the sheet</subtitle>
<p>… but gives a shorter, <emphasis>deeper</emphasis> hull.</p>
</section>
<section id="ch2">
<title><p>Chapter 2. Folding the classic boat</p></title>
<p>… falls open on the water.<a l:href="#note1" type="note">[1]</a></p>
<image l:href="#diagram.png" title="Figure 1. The four steps."/>
</section>
</body>
<body name="notes">
<section id="note1"><title><p>1</p></title><p>A thumbnail or the back of a spoon both work.</p></section>
</body>
<binary id="cover.jpg" content-type="image/jpeg">/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD…</binary>
</FictionBook>- 1
<?xml version="1.0" encoding="UTF-8"?>The XML declaration
Names the text encoding. UTF-8 is the safe choice, but many older files say
windows-1251, the Cyrillic Windows encoding. The declaration must match how the file was actually saved. - 2
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0"The root and its namespaces
The FictionBook namespace identifies the format; files written to the later 2.1 and 2.2 schemas use this same 2.0 address. The XLink namespace, here with the prefix
l, is needed for links to images and notes. - 3
<description>The description
All the metadata, which reading apps use for their library and never show as part of the text.
- 4
<title-info>Information about the book
Genre, author, title and language are required; the annotation (the blurb), keywords, date, cover and series are optional. The schema fixes their order, and genres come from a list of codes such as
home_craftsorsf_history. - 5
<coverpage><image l:href="#cover.jpg"/></coverpage>The cover
A link to a
binaryelement by itsid. FB2 has no separate image files: everything is in this one document. - 6
<document-info>Information about the file
Who made this FB2, when and with what program, a unique
id, and aversionthat should go up every time the file is corrected. - 7
<body>The main body
The first body is the text. It can start with a title and an epigraph, then holds the sections.
- 8
<section id="ch1">Sections
A section is a chapter or part, and its
titlebuilds the table of contents. A section holds either nested sections or text, never both. - 9
<subtitle> … <emphasis>Text elements
Paragraphs (
p),subtitle,empty-line,poemwithstanzaandvlines,cite, and inlineemphasisandstrong. There's no element for fonts, sizes or colours: the reading app decides how everything looks. - 10
<a l:href="#note1" type="note">A note link
Points at a section in another body. With
type="note", readers show it as a superscript footnote marker that leads to the note. - 11
<body name="notes">The notes body
Later bodies hold material outside the main text, most often footnotes.
- 12
<binary id="cover.jpg" content-type="image/jpeg">Binary data
Images, encoded as Base64 text, each with an
idand acontent-type. Base64 makes them about a third larger than the image files, which is one reason FB2 files are often zipped.
Under the hood
The rules an FB2 file follows
The format is defined by an XML Schema. A file that's merely well-formed XML may still break its rules, and stricter readers and e-libraries reject those. The rules that catch people out most often:
- Order matters. Top-level elements go
stylesheet,description,body,binary. Insidetitle-infothe order isgenre,author,book-title,annotation,keywords,date,coverpage,langand so on. - Required metadata.
title-infoneeds at least one genre and author, a title and a language;document-infoneeds an author, a date, an id and a version. - Sections don't mix. A section contains either sub-sections or paragraphs, never both side by side.
- Links are local. Images and note links use XLink
hrefvalues like#cover.jpgthat must match anidin the same file; FB2 can't refer to outside files. - Binary elements need two attributes,
idandcontent-type, and their content must be valid Base64.
How our samples were checked
Each sample is parsed as XML, then checked against these rules: element order in description, title-info and document-info, required elements, section content, Base64 data that decodes to a valid image, and links that resolve. Calibre then reads their metadata and converts them to EPUB with every chapter, note and image.
Versions
FB2 versions, and FB3
- FictionBook 2.0 (2004) is the format most files use, and its namespace, ending in
/fictionbook/2.0, appears in every FB2 file. - 2.1 and 2.2 are later revisions of the schema. They kept the 2.0 namespace, so the namespace doesn't tell you which revision a file follows.
- FB3 (FictionBook 3) is a successor based on a ZIP package with separate files, closer to EPUB, and adds layout features. The Russian e-book shop LitRes, a long-time FB2 user, moved to it internally around 2016 and announced it publicly in 2017, but popular reading apps don't support it.
Comparison
FB2 vs EPUB
| FB2 | EPUB 3 | |
|---|---|---|
| What it is | One XML document | A ZIP of XHTML, CSS, images and XML |
| Markup | Book structure: sections, titles, epigraphs, poems, notes | HTML, styled with CSS |
| Styling | None in practice; the reading app decides | The publisher's CSS, which readers may override |
| Images | Base64 inside the XML | Separate files in the ZIP |
| Fixed layout, audio, video | No | Yes |
| Metadata | Detailed, with fixed genre codes and series | Dublin Core, extensible |
| Standard | Community schema | W3C Recommendation |
| Read on | FBReader, CoolReader, PocketBook and others; not Kindle or Nook | Almost every reading app; Kindle via Send to Kindle |
FB2 is good at what it was made for: novels and other text-first books, kept in large collections with clean metadata. For anything with design, such as illustrated books, cookbooks or textbooks, or for selling through the big Western shops, EPUB is the format to use.
Packaging
.fb2.zip, and why Cyrillic text comes out garbled
An FB2 file is uncompressed XML, and its Base64 images are a third larger than the original image files, so books are often distributed zipped as .fb2.zip (sometimes .fbz). Some readers open the ZIP directly; otherwise unzip it first. Our sample-book.fb2.zip is 35,002 bytes, against 61,083 for the same file unzipped.
Encoding is the other common trap. Many older files, especially Russian ones, are saved as Windows-1251 and declare it in the first line. When a tool ignores the declaration and reads such a file as UTF-8, or when someone converts the file to UTF-8 but leaves encoding="windows-1251" in place, Cyrillic text turns into nonsense:
- Keep the declaration and the bytes in step. If you re-save a file as UTF-8, change the first line to
encoding="UTF-8"too. - Read the declaration in your own code. Use an XML parser on the raw bytes rather than decoding the file as text yourself; the parser follows the declaration.
- Test both.
sample-cp1251.fb2is a short Russian-language book in Windows-1251 for exactly this.
How to
How to open, edit and convert an FB2 file
- Read it: FBReader, CoolReader, AlReader, STDU Viewer, PocketBook e-readers and apps, Okular on Linux, and Calibre's e-book viewer on Windows, macOS and Linux. Kindle and Nook devices don't open FB2, and browsers show it as raw XML or download it.
- Edit it: any text or XML editor works, since it's plain XML. FictionBook Tools, for Windows, includes an editor and a validator.
- Convert it:
ebook-convert book.fb2 book.epubwith Calibre, orpandoc book.fb2 -o book.epubwith Pandoc. Both also write FB2 from other formats. - For a Kindle: convert to EPUB and use Send to Kindle, or convert to AZW3 with Calibre.
- Check its metadata:
ebook-meta book.fb2prints the title, authors, genre tags and annotation.
Converters don't always write FB2 that follows the schema. Calibre 7.6, for example, puts keywords and annotation after lang in title-info. Many readers tolerate this, but if you supply FB2 to an e-library that validates, run its checker first.
Security
Is it safe to open an FB2 file?
FB2 has no scripts or macros, so a book can't run code by design. The risks are those of any XML file and lie with the software that reads it:
- XML entity tricks. A file with a
DOCTYPEcan define entities that expand to gigabytes (the "billion laughs" attack) or pull in local files (XXE). FB2 never needs aDOCTYPE, so software that imports FB2 should switch off DTD processing. - Huge embedded images. Base64 data can be very large or decode to images with enormous dimensions. Set limits before decoding uploaded files.
- ZIP risks for
.fb2.zip: a server that unpacks uploads should guard against path-traversal names and archives that expand to a huge size.
Free downloads
Sample FB2 files to download
Free sample FB2 files for testing e-book readers, converters, XML parsers and upload pipelines. All are well-formed XML, follow the FictionBook 2 schema's rules for the elements they use, and open in Calibre. The book is "A Small Guide to Paper Boats" by the fictional Ada Example.
Loading…What's inside sample-book.fb2
The file is commented: open it in a text editor and each numbered XML comment marks one of these parts.
Comment 1: the root
The
FictionBookelement with the FictionBook 2.0 namespace and the XLink namespace under the prefixl.Comments 2 to 6: the description
title-infowith genre, author, title, annotation, keywords, date, cover and language in schema order;document-infowith the program, source URL, id and version; andpublish-info.Comment 7: the main body
A body title with the book title and author on two lines, and an epigraph with its
text-author.Comment 8: sections
Three chapters with titles, paragraphs, a
subtitle,strongandemphasis, and anempty-line.Comment 9: an image
The folding diagram, placed between paragraphs with an XLink to its binary element.
Comments 10 and 11: a poem and a note
A two-line
poemin Chapter 3, and a footnote link in Chapter 2 that points into a second body namednotes.Comment 12: binary data
A 400 × 600 JPEG cover and the PNG diagram, Base64-encoded in lines of 76 characters.
All sample FB2 files
Sample FB2 book
sample-book.fb2 · 59.7 KB (61,083 bytes)
A three-chapter book with full metadata, a cover, an epigraph, a subtitle, an image, a poem and a footnote, with numbered comments explaining each part.
- Testing FB2 readers and converters
- Learning the structure of FictionBook
Zipped FB2 (.fb2.zip)
sample-book.fb2.zip · 34.2 KB (35,002 bytes)
The same book in a ZIP archive, the way FB2 books are usually distributed. It holds one Deflate-compressed file,
sample-book.fb2.- Testing readers that open `.fb2.zip` directly
- Upload filters that check double extensions
Minimal FB2
sample-minimal.fb2 · 757 bytes
Only what the schema requires: genre, author, title and language, a
document-infowith author, date, id and version, and one section with one paragraph.- Parser tests: no cover, notes or images
- A starting template
Windows-1251 FB2 (Russian)
sample-cp1251.fb2 · 1.2 KB (1,183 bytes)
A short Russian-language text saved in the Windows-1251 encoding and declared as such, like many older FB2 files.
- Testing that tools follow the XML encoding declaration
- Checking Cyrillic text survives a pipeline
Ways to test with them
- Encoding: open
sample-cp1251.fb2in your app. The title should read "Бумажный кораблик"; anything like "Áóìàæíûé" or a row of � characters means the declaration was ignored. - Zipped books: load
sample-book.fb2.zipandsample-book.fb2and compare: the same book should appear, with its cover. - Metadata: expect the title "A Small Guide to Paper Boats", the author Ada Example, the genre
home_craftsand an annotation mentioning 99helpers.com/file-types/fb2. - Notes and images: in
sample-book.fb2, the footnote marker in Chapter 2 should lead to the note, and the diagram should appear in Chapter 2. - Converters: convert
sample-book.fb2to EPUB and check for three chapters, the epigraph, the poem, the note and two images.
Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.
Put it online
Have an FB2 file? Give it a link.
Drop an FB2 or FB2.ZIP file on 99helpers and it gets its own link to share. Browsers don't display FictionBook as a book, so visitors download it and open it in their reading app.
Questions
FB2 files, frequently asked
What is an FB2 file?
An e-book in the FictionBook 2 format: one XML file containing the book's metadata, its text marked up by structure, and its images in Base64. It's especially popular in the Russian-speaking world.
How do I open an FB2 file?
Use FBReader, CoolReader, a PocketBook e-reader or app, or Calibre on a computer. Kindle and Nook devices don't open FB2; convert it to EPUB or AZW3 first.
How do I convert FB2 to EPUB?
With Calibre, use Convert books or run ebook-convert book.fb2 book.epub. Pandoc also works: pandoc book.fb2 -o book.epub.
Can I read FB2 on a Kindle?
Not directly. Convert it to EPUB and send it with Send to Kindle, or convert it to AZW3 with Calibre and copy it to the Kindle by USB.
What is an .fb2.zip file?
An FB2 book compressed in a ZIP archive, usually holding just the one .fb2 file. Some readers open it directly; otherwise unzip it.
Why is the text in my FB2 file garbled?
The file's encoding and its XML declaration disagree, or the app ignored the declaration. Many older FB2 files use Windows-1251; make sure the first line names the encoding the file is actually saved in.
Is FB2 better than EPUB?
For plain text-first books in large collections, FB2's structure and metadata work well. EPUB supports styling, fixed layout and media, is an open W3C standard, and is read by far more apps and shops.
Can I edit an FB2 file?
Yes, in any text or XML editor, since it's plain XML. Keep the elements in the order the schema requires and check that the file stays well-formed.
Related formats
Other file types explained
Keep going
Related
Sources
- MobileRead Wiki: FB2
- Wikipedia: FictionBook
- FictionBook description (Haali Reader)
- FictionBook 2.1 schema documentation: FictionBook element
- FictionBook 2.1 schema documentation: title-info
Last reviewed 27 October 2026.