Remove DRM from Amazon Kindle’s ebooks using Linux

By | August 20, 2010

When you buy an ebook using your Kindle, there’s a 99% chance it’s a DRM file. That means you won’t be able to read it anywhere else but on your Kindle. And we won’t accept that. To be able to convert that file and remove its DRM protection, you need a set of Python scripts called MobiDeDRM.
Now open your Kindle and type 411 on the keypad. This will bring up a window containing information. Write down the 16-character alphanumeric Serial.
Through your computer, buy a book from Amazon.com and save it to your harddrive. The filename shoud be something like Book-Title.azw.
Be sure you have Python installed in Linux. In Ubuntu you can easily install it with sudo apt-get install python.
Extract de files from the MobiDeDRM.zip file and run one of them like this:

python kindlepid.py XXXXXXXXXXX

where XXXXXXXXXXXX is your 16-character Serial. The Terminal window will return something like

Mobipocked PID for Kindle serial# XXXXXXXXXXXXXXXX is Z1QFCDQ*74

That “Z1QFCDQ*74” string is what you need.
Now all you have to do to remove the DRM from the .AZW file is:

python mobidedrm.py Book-Title.azw Book-Title.mobi Z1QFCDQ*74

In a minute or so you should have a DRM-free MobiPocket book you can later convert in any other format you like. If that doesn’t work, try

python mobidedrm2.py Book-Title.azw Book-Title.mobi Z1QFCDQ*74

32 thoughts on “Remove DRM from Amazon Kindle’s ebooks using Linux

  1. Pingback: How to Remove DRM from Amazon's Kindle Books

  2. K_REY_C

    Any chance this will work 100% if you don’t own a Kindle? I’ve been wanting digital content for a while now but I just won’t do the DRM thing — so I lug around a lot of books.

    Reply
  3. T4L Post author

    It should work as long as you have that Kindle Serial and the book you downloaded is DRM-enabled. I own a Nook myself but didn’t buy any books with it yet since the B&N store doesn’t let me use my non-US credit card.

    Reply
  4. K_REY_C

    So how do you get the Kindle Serial w/out the device? At any rate, thanks for this. Once the DRM goes away the honest and thoughtful among us might be able to utilize these newer technologies.

    Reply
  5. Don Marti

    Hate to be the copy editor nerd here, but it’s loaded and misleading to call DRM restrictions “protection”. How about “restrictions” or “scrambling”?

    Reply
  6. Martin

    I am opposed to DRM as well. But I am opposed to advicing people to break DRM, without informing them that it is illegal, because they accepted the licence agreement in the first place.

    In fact, I think you shouldn’t break the DRM. Just pay for the service. Or buy books in a store if you don’t like the service.

    Reply
  7. jr

    The 1st download link only contains the MobiDeDRM script, the 2nd one has 3 versions of this script. The kindlepid.py script is not included.

    Reply
  8. T4L Post author

    @jr: the link has been updated; the zip file should contain now what you need. My bad for not checking the archive earlier.
    @Martin: breaking DRM is illegal in the US. I, on the other hand, don’t live in the US. Secondly, we’re Linux users. We know a thing or two about DRM, so it wasn’t necessary for me to specify it might be illegal.
    @Don Marti: “Protection” was the first word to pop into my head. 🙂 But you might be right there.

    Reply
  9. random internet guy

    @martin

    > without informing them that it is illegal

    It’s not illegal where I live, so it may be legal in most part of the world.

    Reply
  10. anon

    Looks like these instructions are out of date and won’t work anymore. I believe that the newest Kindle firmware uses pid which is tied both to the Kindle serial number and individual books. So the pid one gets with this method won’t work with kindle2 (as long as it has current firmware) or later. I would gladly be wrong — and the files in the archive could be updated to get the working pid for the latest firmware. But it does not look so based on the timestamps of the files in the archive.

    Reply
  11. David Jameson

    I love this in principle because I have more than 5 devices (counting numerous computers, iPhones, and iPads) and I can only have my books on 5 of them, which is really annoying. Ownership should be mapped to users rather than to devices.

    In any case, I’m wondering how I get the serial number for Kindle software running on my iPad so I can try this process.

    Reply
  12. Pingback: Elimina DRM de tus libros Kindle utilizando Linux y Python

  13. Pingback: Ganalot! » Blog Archive » DS Linux

  14. Pingback: de la red – 22/08/2010 « TecnologĂ­as y su contexto

  15. Pingback: El libro electrĂłnico, una incertidumbre para los autores. « Blog multi-temático de Antonio Castro

  16. Pingback: Elimina DRM de tus libros Kindle utilizando Linux y Python | Noticias HMX

  17. D4K

    MobiDeDrm has stopped working.. had worked before, but now says ‘maybe PID is wrong’. Has Amazon found a way of beating mobidedrm?

    Reply
  18. Pingback: Remove DRM from your Kindle library « 0ddn1x: tricks with *nix

  19. Kirby

    While trying to convert .azw and .azw1 files to .mobi, I usually (not always) receive:

    Error: invalid encryption type: 0

    Is anyone else seeing this error?

    Reply
  20. Mai

    I’ve seen several books of Victorian sermons going cheap on kindle format, but own no kindle: i’m going to buy one and try it. Well, $2 i can afford.

    Reply
  21. Ty

    Calibre only converts between ebook formats (epub, mobi, etc), it can’t remove drm. If you want to convert a kindle book to epub with calibre, you first have to figure out a way to remove the drm (such as with these mobidedrm scripts). Of course they don’t seem to work for me with the kindle 3, but I’ve only just started trying…

    Reply
  22. Apprentice Alf

    D4K: Wih firmware update 2.5 for the Kindle 2, and always with the Kindle 3, Amazon now uses a per-book PID for DRMed books downloaded to or for use of the Kindle 2 and Kindle 3.

    Kirby: azw1 files and sometimes azw files are in Amazon’s Topaz format raher than the Mobipocket format. MobiDeDRM only handles Mobipocket format.

    mjjzf: Calibre contains no de-drm abilities on its own for legal reasons.

    There are now solutions for al these problems. A way to generate the per-book PID has been reverse engineered. A way to de-drm and extract the info in Topaz format ebooks has been found. And plug-ins for Calibre that remove DRM have been written.

    Yoy can find full instructions and download links to all the tools (including the latest MobiDeDRM, version 0.24), at my blog:

    http://apprenticealf.wordpress.com/

    — Alf.

    Reply
  23. Jeremy

    This method obviously doesn’t work anymore, but a simple solution if you’re reading legitimately-purchased copies of books is to install the Amazon Kindle Reading App for Windows. It installs flawlessly in WINE (at least on Ubuntu) and gives you instant access to all your purchased titles.

    http://www.amazon.com/gp/feature.html/?docId=1000493771

    Reply
  24. P4Dave

    #Fail? S/No from iPad,
    kindlepid.py works,
    First pgm
    Error: no key found. maybe the PID is incorrec
    Second pgm
    Error: invalid encryption type: 0

    Reply
  25. BLyons

    According the latest court cases in the US, NO… It’s NOT illegal to break DRM to access what you’ve purchased. It IS illegal to break DRM, if you further use the cracked copy to do something else illegal. IOW, if you break security to either pirate or damage someone’s systems, breaking DRM is an additional charge against you. If you do it for access, it has been ruled (at least in one district court…second or fifth, I believe, and if you’re looking for the case, it was specifically dealing with software) legal, overturning that line of the Millennium Act. Of course, if you ask Amazon, they’ll try to tell you Millennium still stands.

    Reply
  26. planfan

    I would be more sympathetic to the DRM issue, if it wasn’t so tied up with limiting competing e-readers from reading books from different providers (note that I said providers NOT publishers or authors). It is important to protect the creators of the work. However, I can’t bring myself to buy an e-reader since whichever one I buy excludes important rights that I believe I have, such as the right to BUY books from anybody and view them on my device. The state of affairs with Amazon, for example, is analogous to Apple building computers and an OS and excluding ANY software other than that created by Apple from working on an Apple computer. That is of course NOT the way things are. Software vendors can write for the Apple platform regardless of whether or not they are part of Apple’s company!

    Reply
  27. Aaron

    @planfan:

    Apple’s walled garden on iOS allows other developers, but only with Apple’s approval. Apple has a TOS that is incompatible with the GNU GPL, so lots of free/open-source software is BANNED from the iOS by Apple. It isn’t (yet) so bad on the Mac, but your analogy is actually more true than you realize. Apple *IS* locking things down.

    Reply
  28. Dave

    Was actually fine with DRM until I paid 40 bucks for a computer book only to realize that Amazon has disabled any use of cut/paste, which means I have to type all kinds of SQL code BY HAND. A huge waste of money and time. Want to crack DRM just to be able to use Ctrl-C while I’m reading it…anyone able to help out? Does MobiDeDRM work anymore? I will never pay $40 bucks for a DRMed book again. But since I’ve got this one, I’d love to be able to find a way to cut and paste. I don’t have a Kindle, just Android and Windows and Linux versions of Amazon Reader. Anyone?

    Reply

Leave a Reply to Don Marti Cancel reply

Your email address will not be published. Required fields are marked *