# How do I check a crate before publishing it to crates.io?
Source: https://ruststudio.org/community/t/122/how-do-i-check-a-crate-before-publishing-it-to-crates-io
Author: Ruststudio Team (staff) | Published: 2026-12-05 | Updated: 2026-12-05 | Checked with: cargo 1.93.0, Windows 11 (dry run only, nothing was uploaded)
Category: Help and questions | Kind: FAQ | Tags: cargo, publishing, crates-io | Views: 0

## Short answer
Fill in the package metadata, look at the files Cargo would upload with cargo package --list, then run cargo publish --dry-run. It packs the crate, compiles the packed copy and stops before uploading. Only then run cargo publish with a token.

## Answer
## Answer
Publishing to crates.io cannot be undone: a version can be yanked (hidden from new projects) but never replaced or deleted. Two commands let you see exactly what would happen first, and neither uploads anything.

## How to do it
1. Fill in the metadata in `Cargo.toml`. crates.io needs `description` and `license` (or `license-file`); `repository`, `documentation` and `readme` are optional but expected.

```toml title=Cargo.toml
[package]
name = "tinycalc"
version = "0.1.0"
edition = "2024"
description = "A tiny calculator library"
license = "MIT"
```

2. List the files that will be in the package. Check that nothing private (keys, test data) is in it.

```text
> cargo package --list
warning: manifest has no documentation, homepage or repository
  |
  = note: see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
Cargo.lock
Cargo.toml
Cargo.toml.orig
README.md
src\lib.rs
```

3. Run the dry run. It builds the package the way it would be uploaded, compiles it in a clean folder, and stops at the upload step.

```text
> cargo publish --dry-run
    Updating crates.io index
warning: manifest has no documentation, homepage or repository
  |
  = note: see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
   Packaging tinycalc v0.1.0 (C:\dev\pkg)
    Packaged 5 files, 1.1KiB (790B compressed)
   Verifying tinycalc v0.1.0 (C:\dev\pkg)
   Compiling tinycalc v0.1.0 (C:\dev\pkg\target\package\tinycalc-0.1.0)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.49s
   Uploading tinycalc v0.1.0 (C:\dev\pkg)
warning: aborting upload due to dry run
```

4. When both are clean, log in once with `cargo login` (the token comes from your crates.io account) and run `cargo publish`.

## Common mistakes
- Reading the dry-run warning about "no documentation, homepage or repository" as an error. It is advice; adding `repository = "..."` removes it.
- Publishing with uncommitted changes. Cargo refuses unless you pass `--allow-dirty`, which the examples above used only because the demo folder is not a real repository.
- Choosing a crate name without checking it is free. The name is yours only once the first publish succeeds.

## Related questions
### Can I take back a published version?
`cargo yank --version 0.1.0` stops new projects from choosing it. Existing projects that already locked it keep working.
