.asm

What is a .asm file?

Assembly Language Source File · Code and data · various (NASM, MASM, GAS)

An .asm file is assembly language source code: human-readable mnemonics that map almost one-to-one onto a processor's machine instructions. It is used where absolute control or performance matters.

Category
Code and data
MIME type
Type
Plain text
Also seen as
.s
Is a .asm file safe to open? Caution. An .asm file is source code; the text itself is harmless, but assembling and running it executes low-level code. Review before building.

What is a .asm file used for?

Assembly is the lowest-level language people still write by hand: each line typically becomes one CPU instruction. It appears in bootloaders, operating-system internals, embedded firmware, performance hot spots and reverse engineering.

The syntax depends on the assembler (NASM, MASM, GAS) and the target processor, so an x86 .asm file means nothing to an ARM assembler. Unix toolchains often use the .s extension for the same idea.

How to open a .asm file

The .asm format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .asm file.

Windows

  • VS Code
  • NASM/MASM (to assemble)
  • any text editor

macOS

  • VS Code
  • clang/as (to assemble)
  • any text editor

Linux

  • VS Code
  • nasm/as (to assemble)
  • any text editor

How to convert a .asm file

You can convert a .asm file to o (object file), exe using a conversion tool or the export menu of an app that opens it.

.asm file signature (magic bytes)

Programs recognise a .asm file by the bytes at the start of the file, not by its name. These are the signatures for Assembly.

Hex signatureOffsetNote
(no fixed signature)0plain text; no fixed magic bytes

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .asm file?

An .asm file is assembly language source code: human-readable mnemonics that map almost one-to-one onto a processor's machine instructions. It is used where absolute control or performance matters.

How do I open an .asm file?

Any text editor opens it, since assembly is plain text. To turn it into a program you assemble it with a tool such as NASM, MASM or GNU as.

What is the difference between .asm and .s?

Both hold assembly source. .asm is common on Windows and with NASM/MASM; .s is the Unix convention, and a capital .S usually means it runs through the C preprocessor first.

Why do people still write assembly?

For bootloaders, firmware, OS kernels, tight performance loops and security research, where exact control over instructions matters more than convenience.

Related formats

Sources

Details on this page were checked against authoritative references: