---
source: https://iinventedlight.com/library/notes/go-mime-multipart.md
title: "Go mime/multipart: parse and write MIME parts"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (Go); BSD-3-Clause (Go); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Go, mime/multipart package reference; Go, mime/multipart source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-mime-multipart"
tags: [go, mime, multipart, http, form]
client: Librarian
sources:
  - id: S1
    title: "mime/multipart package reference"
    publisher: Go
    url: https://pkg.go.dev/mime/multipart
    accessed: 2026-11-23
    license: "BSD-3-Clause"
  - id: S2
    title: "mime/multipart source"
    publisher: Go
    url: https://go.dev/src/mime/multipart/multipart.go
    accessed: 2026-11-23
    license: "BSD-3-Clause"
---
# Go mime/multipart: parse and write MIME parts
**Answer:** Package multipart implements MIME multipart parsing, as defined in RFC 2046. That implementation is sufficient for HTTP and for multipart bodies generated by popular browsers. Limits protect against malicious inputs.

## Parsing and writing parts

The package implements MIME multipart parsing, as defined in RFC 2046.

That implementation is sufficient for HTTP, including RFC 2388, and for multipart bodies generated by popular browsers.

NextPart and NextRawPart limit the number of headers in a part to 10000.

ReadForm further limits the number of parts in a form to 1000. Writer can create form fields and file parts.

## Limits in the source comment

The source comment also describes MIME multipart parsing, as defined in RFC 2046.

To protect against malicious inputs, the package sets size limits on the MIME data it processes.

Header and part caps can be adjusted with GODEBUG settings.

Writer can create form fields and file parts, and reports a FormDataContentType that includes the boundary.

## See also

- [go-mime](https://iinventedlight.com/library/notes/go-mime/)
- [go-net-http-client](https://iinventedlight.com/library/notes/go-net-http-client/)
- [go-encoding-json](https://iinventedlight.com/library/notes/go-encoding-json/)

## Claims

- id: C1
  claim: The package implements MIME multipart parsing as defined in RFC 2046.
  source: S1
  evidence: "MIME multipart parsing, as defined in RFC 2046"

- id: C2
  claim: The implementation is sufficient for HTTP and common browser bodies.
  source: S1
  evidence: "sufficient for HTTP ( RFC 2388 )"

- id: C3
  claim: The source comment describes MIME multipart parsing as defined in RFC 2046.
  source: S2
  evidence: "Package multipart implements MIME multipart parsing, as defined in RFC"

- id: C4
  claim: Limits exist to protect against malicious inputs.
  source: S2
  evidence: "To protect against malicious inputs"

## Sources

- [S1] mime/multipart package reference. Go. https://pkg.go.dev/mime/multipart . License: BSD-3-Clause. Accessed 2026-11-23.

- [S2] mime/multipart source. Go. https://go.dev/src/mime/multipart/multipart.go . License: BSD-3-Clause. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, mime/multipart package reference; Go, mime/multipart source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
