I have an ePub that returns "mimetype entry missing or not the first in archive" error in epubcheck, even though the mimetype file is correctly placed.

How to fix that?

  • How do you know it is correctly placed?
    – mmmmmm
    Commented Jan 5, 2019 at 14:06

7 Answers 7


This error can occur when the mimetype is compressed inside the epub zip file. What can be done is to create a zip file with only the mimetype file inside but with no compression.

You can do that with 7-Zip setting the Compression level to Store.

In Linux, you can also do that with the terminal command:

zip -0 file.epub mimetype

Then drag and drop the META-INF and OEBPS folders to the file.zip and change the extension to .epub, as usual. With the Linux terminal you can use this command line instead:

zip -9 -r file.epub META-INF OEBPS
  • 1
    So how do you achieve this on Windows using 7Zip? I tried different settings and approaches and i'm still getting the same error message. Is there any other tool that somebody can recommend to use? Commented Mar 2, 2020 at 23:27

zip -X0 ../myEPUB.epub mimetype
zip -9 -r ../myEPUB.epub META-INF OEBPS

another common error i was getting was extra characters in mimetype 'Mimetype file should only contain the string 'application/epub+zip' and should not be compressed' I found that my editor Geany was adding a newline when I saved the file and this caused an epubcheck error - a tweak in Geany's preferences fixed this error and epubcheck returned no errors


As the accepted answer states, the mimetype file should be stored uncompressed in the archive. For those looking for a programmatic way to validate and package an EPUB I recommend using the Java EPUBCheck tool by W3C. You can use it as a command line tool and as a Java library. The tool allows you to validate an expanded EPUB folder and save it as an EPUB compressed archive upon successful validation.

Example command:

java -jar epubcheck.jar epub/ --mode exp --save

Read the wiki.

  • I got weird error Mode required for non-epub files. Default version is 3.0.. I got stuck on it a bit. But my stupid error was that I had there quotes: java -jar epubcheck.jar "epub/ --mode exp --save". When I removed quotes it works like charm. Thanks. Commented Jul 9 at 6:52

7-zip sorts files by names

  1. rename mimetype to ##mimetype
  2. Add to archive... ##mimetype
    Archive: book.zip
    Archive format: zip
    Compression level: Store
  3. Add to archive... the other folders META_INF EPUB
    Archive: book.zip
    Archive format: zip
    Compression level: Normal
  4. Open archive... book.zip
    rename: ##mimetype to mimetype
  5. rename book.zip to book.epub

Here are the steps I used to force the "mimetype" file to be the first in the EPUB archive using 7-Zip in Windows:

  1. Make a copy of your EPUB (zip) file (e.g. MyBookCopy.epub), so to not damage your original EPUB file in case things go wrong.

  2. Extract all of the files from MyBookCopy.epub into an empty folder (e.g. MyFolder)

  3. Using the 7-zip UI, delete all the files in MyBookCopy.epub except the “mimetype” file

  4. Using the 7-zip UI, rename the “mimetype” file to “##mimetype” (this will ensure it remains listed first under the covers)

  5. Using the 7-zip UI, re-add all the other epub files in MyFolder into your EPUB file (i.e. drag & drop all these files into the 7-zip window where your epub is open)

  6. Using the 7-zip UI, rename the “##mimetype” file back to “mimetype” (this will not alter its actual order in the ZIP file, even if its order changes in the UI)

Note: At any time, you can verify the actual order of the files in your EPUB file by running this command in a command prompt window: 7z l -slt "MyBookCopy.epub" (in the resulting output, locate the entry for the “mimetype” file and check that its “offset” value is “0” which means it’s the first file stored in the EPUB file).


The trick is to SELECT the files in the order in which they are to be stacked.

For Windows users, do the following:

  1. Go to the folder that contains your ePub files.
  2. CTRL+CLICK to select your files in the following order: (a) mimetype, (b) META-INF folder, and then (c) OPS folder.
  3. With all three items are selected (in that order), RIGHT-CLICK, and then select Send To > Compressed (zipped) folder.
  4. Change your .zip file type to .epub.
  5. Run it through the ePub Validator to confirm the file.

Good luck!

  • It would be useful to explain how do to get an option "Compressed (zipped) folder" in the "Send To" menu in the first place, as there are only options for messaging, email, burn to CD, backup and send via Bluetooth there.
    – Anthon
    Commented Sep 17, 2014 at 6:10
  • this doesn't work to get rid of the error message from epubchecker. Commented Mar 2, 2020 at 23:29

I tried to pack first mimetype to 7-zip and then add rest. Like this:

"C:\Program Files\7-Zip\7z.exe" a -mx0 file.epub mimetype
"C:\Program Files\7-Zip\7z.exe" a -mx0 file.epub ../v0/*

and it does not work with 7-zip.

One option that worked for me was to download Sigil free ePub editor. Then you can pack folder with 7-zip and open in Sigil. Sigil will automatically repair the archive upon opening...

Another option was to use Total Commander internal zip archiver.

  1. click mimetype
  2. Click Files->Pack (alt+F5)
  3. Right top corner set compress rate to 0
  4. click ok and it will create mimetype.zip

Then open that mimetype.zip archive in total commander and copy (F5) there rest files. In copy dialog set compression level back to 5.

Rename mimetype.zip to yourName.epub and you are done.

New contributor
Vit Bernatik is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.