Privacy: Your PDF file is not sent to any server; everything happens locally in your browser. To verify this, you can disconnect from the internet after loading this page, or even simply save this page (everything is self-contained in a single HTML file) and use it offline.
Sometimes you may have a PDF that contains some two-page spreads (the “left” and “right” pages, also known as verso and recto) on a single PDF page. If you want to turn such a PDF into a “regular” PDF, “upload” it above, and click on the link to download a new PDF file with split pages.
To account for the common case where the PDF may also contain some non-spread pages (front cover, etc.), this splits only the pages that have width greater than height. Edit the code if you don't want this feature.
The code rearranges pages using pdf-lib (GitHub) (v1.17.1) by Andrew Dillon. I tried to use Mozilla's PDF.js, but its documentation on these “core” matters (as opposed to just rendering a PDF in a canvas or whatever) seems poor/nonexistent compared to pdf-lib, which is excellent.
This page borrows heavily from a couple of pages I wrote earlier for other purposes: Möbius-printing helper, Extract PDF pages.
The modification for right-to-left page layout was done in January 2023 at the request of Humza Khan working with Arabic manuscripts where the right half of the spread should be placed before the left half.
Contact: My name is Shreevatsa; my email address is my name AT gmail.com. Or leave a comment on this answer.