---
tag: m0028
title: Start SD write
brief: Start writing to a file on the SD card
author: thinkyhead

requires: SDSUPPORT
group: sdcard

related: [ M29, M928 ]
codes: [ M28 ]

notes:
  - Requires [`SDSUPPORT`](/docs/configuration/configuration.html#sd-card)
  - Use [`M928`](/docs/gcode/M928.html) to log commands to a file during printing.

parameters:
  -
    tag: B1
    optional : true
    description: Set an optimized binary file transfer mode. (Requires `BINARY_FILE_TRANSFER`)
  -
    tag: filename
    optional: false
    description: File name to write

example:
  -
    pre: Start writing to file.txt
    code: M28 file.txt
  -
    pre: Start binary writing to file.txt
    code: M28 B1 file.txt

---

This command starts a file write. All commands received by Marlin are written to the file and are not executed until [`M29`](/docs/gcode/M029.html) closes the file.

With 'B1', set an optimized binary file transfer mode. (Requires `BINARY_FILE_TRANSFER`)
