---
source: https://iinventedlight.com/library/notes/rust-release-profiles.md
title: "Rust release profiles: customize dev and release opt-level in Cargo"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (The Rust Project Developers); MIT OR Apache-2.0 (The Rust Project Developers); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Rust Project Developers, Customizing Builds with Release Profiles; The Rust Project Developers, Customizing Builds with Release Profiles (source). MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). 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: rust-release-profiles"
tags: [rust, cargo, profiles, opt-level, release]
client: Librarian
sources:
  - id: S1
    title: "Customizing Builds with Release Profiles"
    publisher: The Rust Project Developers
    url: https://doc.rust-lang.org/book/ch14-01-release-profiles.html
    accessed: 2026-11-26
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "Customizing Builds with Release Profiles (source)"
    publisher: The Rust Project Developers
    url: https://raw.githubusercontent.com/rust-lang/book/main/src/ch14-01-release-profiles.md
    accessed: 2026-11-26
    license: "MIT OR Apache-2.0"
---
# Rust release profiles: customize dev and release opt-level in Cargo
**Answer:** Cargo profiles let you change settings such as opt-level for dev (cargo build) and release (cargo build --release).

## dev and release

Cargo ships predefined, adjustable profiles so you can control how code is compiled.

Each profile is configured independently of the others.

The two main profiles are dev, used by a plain cargo build, and release, used by cargo build --release.

dev favors short compile times and, by default, no optimizations.

The release profile has good defaults for release, trading longer compile time for faster code.

Cargo has default settings for each of the profiles that apply when you haven't added any [profile.*] sections in Cargo.toml, and adding a section overrides a subset of the default settings.

## opt-level

The default opt-level for the dev profile is 0, and the default for the release profile is 3.

opt-level controls how many optimizations Rust applies, in a range from 0 to 3.

Applying more optimizations extends compiling time, so in development you will want fewer optimizations to compile faster.

In release mode you compile infrequently and then run the compiled program many times.

Setting opt-level to 1 on the development profile applies more optimizations than the default, though still not as many as a release build.

Cargo's documentation lists every option and default.

## See also

- [rust-publishing-crates](https://iinventedlight.com/library/notes/rust-publishing-crates/)
- [rust-cargo-workspaces](https://iinventedlight.com/library/notes/rust-cargo-workspaces/)
- [rust-cargo-features](https://iinventedlight.com/library/notes/rust-cargo-features/)

## Claims

- id: C1
  claim: Cargo uses the dev profile for cargo build and the release profile for cargo build --release.
  source: S1
  evidence: "the dev profile Cargo uses when you run cargo build"

- id: C2
  claim: The default opt-level is 0 for dev and 3 for release.
  source: S1
  evidence: "The default opt-level for dev is therefore 0"

- id: C3
  claim: opt-level ranges from 0 to 3 and higher values take longer to compile.
  source: S2
  evidence: "with a range of 0 to 3."

## Sources

- [S1] Customizing Builds with Release Profiles. The Rust Project Developers. https://doc.rust-lang.org/book/ch14-01-release-profiles.html . License: MIT OR Apache-2.0. Accessed 2026-11-26.

- [S2] Customizing Builds with Release Profiles (source). The Rust Project Developers. https://raw.githubusercontent.com/rust-lang/book/main/src/ch14-01-release-profiles.md . License: MIT OR Apache-2.0. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Rust Project Developers, Customizing Builds with Release Profiles; The Rust Project Developers, Customizing Builds with Release Profiles (source). MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. Text was condensed and changed from the originals.

---

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