.S

S File

Assembly Language Source File
Ask a question
QUICK ANSWER

A .s file is an assembly language source file - plain text containing low-level CPU instructions for a specific processor such as x86-64 or ARM. Any text editor opens it for viewing. To build it into a program, run "gcc file.s -o program" on Linux or macOS, or use MinGW or MASM on Windows. The file is safe to open; risk only begins if you assemble and run untrusted code.

Developer: N/A (compiler/toolchain convention - GNU, Unix C toolchains) Category: Developer Files Open standard MIME: text/x-asm
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Aug 4, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the S file format?

A .s file is a plain-text assembly language source file used across Unix, Linux, macOS, and embedded toolchains. It contains human-readable CPU instructions - mnemonics, operands, assembler directives, and labels - that an assembler translates directly into object code.

The .s extension is a Unix C compiler pipeline convention dating to the 1970s. Running gcc -S on a C source file halts compilation after code generation and writes a .s file, letting you inspect or hand-tune the compiler's output before assembling. That file is then passed to as (the GNU assembler) to produce a .o object file ready for linking.

A subtle but important convention separates lowercase .s from uppercase .S: .s files go directly to the assembler, while .S files pass through the C preprocessor first, allowing #include, #define, and #ifdef directives - a distinction kernel and firmware codebases rely on heavily.

Syntax varies by toolchain. GNU as defaults to AT&T syntax on x86; Windows assemblers such as MASM and Intel-style NASM use Intel syntax. The same .s file layout is used regardless of target ISA - x86-64, ARM/AArch64, RISC-V, MIPS, and others - so the extension itself conveys no architecture information.

.s files carry no magic bytes and have the MIME type text/x-asm. Any text editor opens them; editors with assembly syntax highlighting such as VS Code, Vim, and Emacs are preferred for larger files. The closely related .asm extension serves the same purpose on many non-Unix toolchains.

Security & safety

RISK: LOW

A .s file is plain text and does nothing on its own - it cannot run until you deliberately assemble and execute it. The risk is the same as any source code you choose to build: assembly can contain instructions that do anything the CPU allows, so only assemble and run .s files from sources you trust, and read unfamiliar assembly before building it. Opening a .s in a text editor to view it is completely safe.

Format details

in a nutshell
FULL NAMEAssembly Language Source Fileaka Assembly source, Assembler source
DEVELOPERN/A (compiler/toolchain convention - GNU, Unix C toolchains)since 1970s (Unix C compiler toolchain convention)
MIME TYPEtext/x-asm
TYPEPlain-text assembly source code
STANDARDOpen · royalty-free
This extension is also used by…
  • S programming language source - Source code for the S statistical language (predecessor of R); rare today, still seen in legacy statistics code.
  • Scheme source (uncommon) - Occasionally a Scheme/Lisp source file, though .scm is the usual extension.

Programs that open S files

Windows3 apps
Notepad Open-source Open directly; Language menu has Assembly highlighting. Lightweight viewing/editing.
Visual Studio Code Free Open the .s file; install an 'x86/ARM Assembly' extension for syntax highlighting. Edit as plain text.
MASM / MinGW-w64 GCC (to assemble) Free To build it: 'gcc file.s -o program.exe' (MinGW) or 'ml64' (Visual Studio's MASM).
macOS2 apps
Visual Studio Code Free Edit the .s; build with the Xcode command-line tools: 'cc file.s -o program' or 'as'.
Xcode command-line tools (clang/as) Free Install with 'xcode-select --install', then assemble using clang/as from Terminal.
Linux3 apps
GNU as (binutils) + GCC Open-source Assemble with 'as file.s -o file.o' or build directly with 'gcc file.s -o program'. The reference toolchain.
GNU Emacs / Vim Open-source Open in asm-mode (Emacs) or with syntax highlighting (Vim) to read and edit.
gedit / any text editor Open-source Open as plain text for quick viewing; gedit highlights common assembly syntaxes.

Technical details

deep spec
File typePlain-text assembly language source
MIME typetext/x-asm (also accepted: text/x-assembly, text/plain)
EncodingASCII / UTF-8
File signature (magic bytes)None - plain text with no fixed header; typically begins with a comment (#, ;), a label (ending in :), or a directive such as .text or .global
Line structureOptional label, assembler directive or CPU mnemonic with operands, inline comment - one logical operation per line
Case conventionLowercase .s is assembled directly; uppercase .S is first run through the C preprocessor (supports #include, #define, #ifdef)
Compiler emissiongcc -S or clang -S emits a .s file from C/C++ source, halting the build pipeline after code generation and before assembly
Supported ISAsx86-64, ARM/AArch64, RISC-V, MIPS, POWER/PowerPC, AVR, and others - the extension is ISA-neutral
Syntax variantsAT&T syntax (GNU as default on x86), Intel syntax (MASM, NASM), ARM Unified Assembly Language (UAL)
Common assembler directives.text, .data, .bss, .global, .section, .align, .byte, .word, .long, .string
ToolchainsGNU Binutils (as), LLVM/Clang integrated assembler, Microsoft MASM, NASM, yasm, armasm
Build pipeline roleIntermediate text stage between compiler code-generation and object-file creation; assembled by as or equivalent to produce a .o file
Preprocessing supportThe .S variant (uppercase) is passed through cpp before assembly, enabling conditional compilation and macro expansion inside asm source
Typical file size1 KB - 500 KB
Associated environmentsLinux, Unix, macOS, Windows, embedded/bare-metal (microcontrollers, kernel startup code, bootloaders)
Released1970s (Unix C compiler toolchain convention)
Latest versionN/A (no versioned spec; depends on target CPU ISA and assembler)
Open standardYes · royalty-free
Specificationsourceware.org

S conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with S files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about S files.

Frequently asked questions

What is a .s file?
It's an assembly language source file - plain-text, low-level CPU instructions for a specific processor (x86, ARM, RISC-V, etc.). It's what a C compiler emits before producing machine code, and what hand-written assembly is saved as.
How do I open a .s file?
Open it in any text editor or IDE - VS Code, Notepad++, vim, Emacs. To actually build it, use an assembler/toolchain such as GNU as or 'gcc file.s -o program'.
What's the difference between .s and .S?
Lowercase .s is pure assembly the assembler reads directly. Uppercase .S is assembly that's first run through the C preprocessor, so it can use #include, #define and #ifdef (common in OS/kernel code). The case matters on Unix/Linux.
How do I compile a .s file?
On Linux/macOS: 'gcc file.s -o program' (assemble + link) or 'as file.s -o file.o' (just assemble). On Windows use MinGW's gcc or MASM's ml64. You need the assembler matching the file's CPU and syntax.
Can I convert assembly (.s) back to C?
Not faithfully. Assembly drops the high-level structure C needs, so there's no true .s-to-C converter. Decompilers like Ghidra produce approximate C from compiled binaries, not equivalent source.
Is .s the same as .asm?
They're both assembly source. .s is the Unix/GNU convention (often AT&T syntax via GNU as); .asm is more common on Windows/DOS (NASM, MASM, often Intel syntax). The CPU and assembler determine the dialect, not the extension.

References

1GNU Assembler (as) manual - Sourcewaresourceware.org
2GCC - Overall options (-S emits assembly)gcc.gnu.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.BINCD/DVD Disc Image (BIN/CUE)
5.RPMSGRestricted Permission Message
6.MDMarkdown Document
7.NOMEDIAAndroid No-Media Marker File
8.PRO6XProPresenter 6 Bundle File
9.EXEWindows Executable (Portable Executable)
10.PRDXSoftMaker Presentations Document

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z