A TypeScript library and CLI tool for converting Audible AAX audiobooks to M4B or M4A. Conversion is a lossless decrypt-and-remux of the original AAC audio — there is no re-encoding, so there is zero quality loss.
- Convert AAX files to M4B or M4A (lossless — the original AAC stream is preserved bit-for-bit)
- Preserve chapter markers, embedded metadata, and cover art
- Automatically detect the Audible activation code (via the
audibleCLI, or by trying known codes) - Pure-TypeScript decryption + MP4 remux — no
ffmpegrequired - Simple command-line interface
# Install globally
npm install -g @stacksjs/aax
# Or use with npx
npx @stacksjs/aaxaudible(optional) — only needed to auto-detect your activation code. If you already know your activation code you can pass it with-cand skip this entirely.
No ffmpeg is required: decryption and remuxing are done entirely in TypeScript.
Please read Using the Audible CLI Integration for more information.
aax convert /path/to/audiobook.aaxaax convert /path/to/audiobook.aax --format m4a --output ./my-audiobooks --code 2c1eeb0aaax split /path/to/audiobook.aaxThis produces one output file per chapter (named 01 - <chapter title>.m4b, etc.) in the book's output folder, each tagged with the chapter title and the book's cover art. Books without usable chapter marks fall back to a single file.
-o, --output <dir>- Output directory (default: ./converted)-f, --format <format>- Output format:m4borm4a(default:m4b)-c, --code <code>- Audible activation code (8-char hex; auto-detected if not provided)--chapters- Preserve chapter information (default: true)-v, --verbose- Enable verbose logging--flat-folder-structure- Use a flat output folder structure--series-title-in-folder-structure- Include the series title in the folder structure--use-named-chapters- Use named chapters if available
import { convertAAX } from 'aax'
async function convertBook() {
const result = await convertAAX({
inputFile: '/path/to/audiobook.aax',
outputFormat: 'm4b',
outputDir: './converted',
chaptersEnabled: true,
// activationCode: '2c1eeb0a', // optional; auto-detected if omitted
})
if (result.success) {
console.log(`Conversion complete: ${result.outputPath}`)
}
else {
console.error(`Conversion failed: ${result.error}`)
}
}You can create an aax.config.ts or aax.config.js file in your project root to customize default settings:
export default {
verbose: true,
outputFormat: 'm4b', // 'm4b' | 'm4a'
outputDir: './my-audiobooks',
chaptersEnabled: true,
// Optional: manually set the activation code (auto-detected if omitted)
// activationCode: '2c1eeb0a',
// Output folder/file structure
flatFolderStructure: false,
seriesTitleInFolderStructure: true,
fullCaptionForBookFolder: false,
partFolderPrefix: 'standard',
sequenceNumberDigits: 2,
// Chapters & extras
useNamedChapters: true,
verifyChapterMarks: 'all',
preferEmbeddedChapterTimes: true,
extractCoverImage: true,
}Note: because conversion is a lossless remux of the source audio, bitrate/transcoding options (
bitrate,variableBitRate,reduceBitRate,aacEncoding44_1) do not change the output and are reserved for a future transcoding pipeline.
This tool integrates with the Audible CLI to automatically retrieve activation bytes (activation codes) from Audible's servers using your account credentials. This makes it much easier to convert your AAX audiobooks without manually finding activation codes.
- Download the Audible CLI binary and place it in the root of your project:
- Audible CLI Releases
- Choose the appropriate version for your OS (e.g.,
audible-cli-0.2.0-windows-amd64.exefor Windows) - Rename it to
audibleand place it in the project root
Run the setup command:
aax setup-audibleThis will:
- Check if the audible binary exists
- Make it executable
- Run the quickstart wizard (you'll need to follow the interactive prompts to log in to your Audible account)
- Retrieve your activation bytes from Audible's servers
- Save them for future use
During the setup process, you'll see something like this:
Setting up Audible CLI and retrieving activation bytes...
Note: You may be prompted to log in to your Audible account.
Follow the prompts in the terminal to complete the setup.
Attempting to get activation bytes from Audible CLI...
Audible CLI is not configured. Setting up...
Starting Audible CLI quickstart. Please follow the prompts to log in to your Audible account.
# ... (interactive login process)
Fetching activation bytes from Audible server...
✅ Found activation bytes from Audible CLI: 2c******
✅ Successfully retrieved activation bytes: 2c******
You can now use this activation code with the convert command:
aax convert your-audiobook.aax -c 2c1eeb0a
The activation code has been saved and will be used automatically for future conversions.
Once set up, your activation code will be automatically used for all future conversions, so you don't need to specify it manually.
If the automated setup fails, you can do it manually:
- Run:
./audible quickstart - Follow the prompts to log in to your Audible account
- Once set up, run:
./audible activation-bytes - Note the activation code (a 8-character hex string like
2c1eeb0a) - Use this code with the convert command:
aax convert your-audiobook.aax -c YOUR_ACTIVATION_CODENote that this software does not 'crack' the DRM or circumvent it in any other way. The application simply applies the user's own activation code (associated with their personal Audible account) to decrypt the audiobook in the same manner as the official audiobook playing software does.
Please only use this application for gaining full access to your own audiobooks for archiving / conversion / convenience. De-DRMed audiobooks must not be uploaded to open servers, torrents, or other methods of mass distribution. No help will be given to people doing such things. Authors, retailers and publishers all need to make a living, so that they can continue to produce audiobooks for us to listen to and enjoy.
Amazon's lack of Mac support requires us to act.
Please see CONTRIBUTING for details.
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
Join the Stacks Discord Server
"Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
- @audiamus for the original AaxAudioConverter
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
The MIT License (MIT). Please see LICENSE for more information.
Made with 💙

