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

group: sdcard
requires: SDSUPPORT

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

notes: Use [`M928`](/docs/gcode/M928.html) to log commands to a file during printing.

parameters:

- tag: B1
  optional : true
  requires: BINARY_FILE_TRANSFER
  description: Set an optimized binary file transfer mode.

- tag: filename
  optional: false
  description: File name to write

examples:

- 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`)
