File types · Explainer

The FB2 file (.fb2, .fb2.zip)

An FB2 file is an e-book in the FictionBook 2 format: a single XML document that holds a book's metadata, its text marked up by structure, and its images. This guide explains what's inside one, how it compares with EPUB, why some FB2 files show garbled text, and has free sample FB2 files to download for testing.

At a glance

Full name
FictionBook 2
Extensions
.fb2; zipped as .fb2.zip or .fbz
MIME type
application/x-fictionbook+xml (unofficial; none is registered)
Kind
Plain text (XML), with images embedded as Base64
Standard
FictionBook 2 XML Schema, maintained by Russian developers and e-library operators
First released
2004, by Dmitry Gribov
Namespace
http://www.gribuser.ru/xml/fictionbook/2.0
Opens with
FBReader, CoolReader, PocketBook e-readers, Calibre, Okular; not Kindle, not browsers
Magic number
None; files start with <?xml and the root element is <FictionBook>

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.

sample-book.fb2 (shortened)
<?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. 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. 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. 3<description>

    The description

    All the metadata, which reading apps use for their library and never show as part of the text.

  4. 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_crafts or sf_history.

  5. 5<coverpage><image l:href="#cover.jpg"/></coverpage>

    The cover

    A link to a binary element by its id. FB2 has no separate image files: everything is in this one document.

  6. 6<document-info>

    Information about the file

    Who made this FB2, when and with what program, a unique id, and a version that should go up every time the file is corrected.

  7. 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. 8<section id="ch1">

    Sections

    A section is a chapter or part, and its title builds the table of contents. A section holds either nested sections or text, never both.

  9. 9<subtitle> … <emphasis>

    Text elements

    Paragraphs (p), subtitle, empty-line, poem with stanza and v lines, cite, and inline emphasis and strong. There's no element for fonts, sizes or colours: the reading app decides how everything looks.

  10. 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. 11<body name="notes">

    The notes body

    Later bodies hold material outside the main text, most often footnotes.

  12. 12<binary id="cover.jpg" content-type="image/jpeg">

    Binary data

    Images, encoded as Base64 text, each with an id and a content-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. Inside title-info the order is genre, author, book-title, annotation, keywords, date, coverpage, lang and so on.
  • Required metadata. title-info needs at least one genre and author, a title and a language; document-info needs 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 href values like #cover.jpg that must match an id in the same file; FB2 can't refer to outside files.
  • Binary elements need two attributes, id and content-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

FB2EPUB 3
What it isOne XML documentA ZIP of XHTML, CSS, images and XML
MarkupBook structure: sections, titles, epigraphs, poems, notesHTML, styled with CSS
StylingNone in practice; the reading app decidesThe publisher's CSS, which readers may override
ImagesBase64 inside the XMLSeparate files in the ZIP
Fixed layout, audio, videoNoYes
MetadataDetailed, with fixed genre codes and seriesDublin Core, extensible
StandardCommunity schemaW3C Recommendation
Read onFBReader, CoolReader, PocketBook and others; not Kindle or NookAlmost 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.fb2 is 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.epub with Calibre, or pandoc book.fb2 -o book.epub with 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.fb2 prints 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 DOCTYPE can define entities that expand to gigabytes (the "billion laughs" attack) or pull in local files (XXE). FB2 never needs a DOCTYPE, 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.

sample-book.fb2 · 59.7 KBDownloadOpen
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.

  1. Comment 1: the root

    The FictionBook element with the FictionBook 2.0 namespace and the XLink namespace under the prefix l.

  2. Comments 2 to 6: the description

    title-info with genre, author, title, annotation, keywords, date, cover and language in schema order; document-info with the program, source URL, id and version; and publish-info.

  3. Comment 7: the main body

    A body title with the book title and author on two lines, and an epigraph with its text-author.

  4. Comment 8: sections

    Three chapters with titles, paragraphs, a subtitle, strong and emphasis, and an empty-line.

  5. Comment 9: an image

    The folding diagram, placed between paragraphs with an XLink to its binary element.

  6. Comments 10 and 11: a poem and a note

    A two-line poem in Chapter 3, and a footnote link in Chapter 2 that points into a second body named notes.

  7. 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-info with 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.fb2 in your app. The title should read "Бумажный кораблик"; anything like "Áóìàæíûé" or a row of � characters means the declaration was ignored.
  • Zipped books: load sample-book.fb2.zip and sample-book.fb2 and 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_crafts and 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.fb2 to 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

Last reviewed 27 October 2026.