For the complete documentation index, see llms.txt. This page is also available as Markdown.

Exporting and copying listings

Every listing — the flat disassembly, the hex view, the decompiler's pseudocode and microcode, and the type listing — can be copied to the clipboard or exported to an HTML file. Both operations share the same idea: you point at what you want (or select it), and IDA renders it faithfully, in your current colors.

This page covers the two flows:

What gets copied or exported

The scope is decided the same way everywhere, in this order:

  1. The selection, if there is one. Selections are column-precise: the copy starts and ends exactly where the painted selection does: the first line from the selection's start column, the last line up to its end column (a selection ending before a line's first glyph contributes nothing of that line).

  2. The highlighted identifier, if any: click a name to highlight it, and a copy takes just that word.

  3. Otherwise, the item under the cursor: the whole function in a disassembly or pseudocode listing (including its tail chunks, wherever in the address space they live), the whole type in a type listing, or the current item elsewhere.

When you want whole lines rather than column precision, hold Ctrl before starting the mouse selection: this enters full-lines mode, where every line the selection touches is selected in full: painted, copied and exported as whole lines. (On macOS this is the ⌃ Control key, not ⌘ Command.) Here is the same drag, without and with Ctrl:

A regular selection is column-precise: it starts and ends exactly where you drag
The same drag started with Ctrl held selects full lines

You never have to guess: the submenu's caption names what a copy will grab: Copy selection, Copy highlight, Copy function, Copy type, or Copy item.

Copying to the clipboard

Right-click any listing: the Copy ... submenu is the first entry. It offers the flavors that apply to that listing:

  • As text: plain text, exactly as the listing shows it. This is the plain copy, bound to Ctrl+C (or your platform's Copy key).

The As text flavor in the Copy submenu

For example, with the cursor inside main of a small program, As text puts the whole function on the clipboard:

  • As HTML: the same text carrying the listing's syntax colors, so it pastes styled into rich-text editors, chats and documents. The HTML source is also placed on the plain-text clipboard flavor, so pasting into a plain-text editor yields the markup itself, ready to embed.

The As HTML flavor in the Copy submenu

Here is the same main, copied As HTML. A whole function's markup is a wall of <span>s, so this sample is a selection of its first fifteen lines: the function header in full, stopping just short of the first instruction.

Every HTML flavor (the clipboard's, and the exported files' below) inlines the colors of your current IDA color theme, read live from the view. Switch theme, and the next copy or export follows it; nothing hard-codes a fixed palette.

  • As deeplink: an ida:// URL to the current location, for sharing an exact spot in the database with your team. See Using Deep Links.

The As deeplink flavor in the Copy submenu
  • Copy with dependencies: in type listings only: the C-style declarations of the type(s), together with every type they depend on, so the result compiles on its own.

Copy with dependencies on a type listing

In the Local Types side tree, the same submenu appears as Copy type (or Copy types, following your selection), offering the deeplink and with-dependencies flavors for the selected types. The plain Ctrl+C in the tree copies the item names, as in every tree.

The Copy types submenu in the Local Types side tree

Every copy is confirmed in the Output window ("Copied ... to clipboard").

In the hex view, copies currently cover whole lines; a block (column) selection is copied with its full lines.

Exporting to an HTML file

Choose File → Produce file → Export to HTML... (the label follows the context: Export selection to HTML..., Export "IDA View-A" to HTML...). With an active selection, the action is also offered at the end of the listing's context menu.

The Export to HTML dialog

The dialog offers:

  • Output file: where the page is written. The suggested name follows the export scope: the subject's name for a current-function/type export, the input file's name for a whole-listing one.

  • Template: how the page is rendered (see the templates below). The frame underneath describes the selected template; its tooltip shows the template file that will run.

  • Export: what to export: the current function/type under the cursor, or the entire listing. These radios appear only when there is no selection; a selection is the scope, and is exported as-is.

  • Expand collapsed functions, for disassembly exports: collapsed functions and hidden ranges are rendered in full (the view's fold state is restored afterwards).

  • Open in browser: open the result when done.

The template choice and the options are remembered across sessions. Generation shows a progress dialog and can be cancelled at any point; a cancelled export leaves no partial file behind.

The templates

Three templates ship with IDA:

  • Plain static export: a standalone HTML page of the listing, with IDA's colors, and no interactivity.

A plain static export rendered in a browser
  • Interactive with sidebar: a standalone page featuring a sidebar listing the exported functions, a live jump-arrow gutter, in-document links for names and cross-references (offset-aware, pseudocode call targets included), and toggles for prefixes, cross-references, comments and arrows.

An interactive export rendered in a browser
  • Snippet: a paste-ready HTML fragment: an inline-styled block with per-span colors and no stylesheet, to drop into a document.

The templates are IDAPython scripts, shipped with the IDAPython examples and installed under idadir/python/examples/templates — the README.md there documents the contract. Picking Custom... in the template combo lets you run your own: any .py file exposing a title, a description, and a run() entry point. The shipped templates are the reference to start from.

Without IDAPython, the export falls back to a built-in generator producing a plain static page; the template picker is not shown.

Scripting the export

The engine behind both flows is scriptable. From IDAPython:

A complete headless example (exporting a database's listing without opening the UI) ships as the export_listing.py example of idalib.

See also

  • Using Deep Links: sharing and following ida:// links.

  • Working with types: the type listing and Local Types view.

  • The File → Produce file menu: the other output formats (ASM, LST, MAP, ...).

Last updated

Was this helpful?