---
source: https://iinventedlight.com/library/notes/go-strconv.md
title: "Go strconv: convert values to and from strings"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (Go docs); BSD-3-Clause (Go source); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Go docs, strconv package; Go source, doc.go. 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-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). 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 strconv"
tags: [go, strconv, atoi, itoa, parse, format]
client: Librarian
sources:
  - id: S1
    title: "strconv package"
    publisher: Go docs
    url: https://pkg.go.dev/strconv
    accessed: 2026-11-18
    license: "BSD-3-Clause"
  - id: S2
    title: "doc.go"
    publisher: Go source
    url: https://raw.githubusercontent.com/golang/go/master/src/strconv/doc.go
    accessed: 2026-11-18
    license: "BSD-3-Clause"
---
# Go strconv: convert values to and from strings
**Answer:** Package strconv implements conversions to and from string representations of basic data types. The most common numeric conversions are Atoi (string to int) and Itoa (int to string). ParseBool, ParseFloat, ParseInt, and ParseUint convert strings to values.

## Examples

```go
package main
import "strconv"

func main() {
    i, _ := strconv.Atoi("-42")
    s := strconv.Itoa(-42)
    _, _, _ = i, s, strconv.FormatBool(true)
}
```

## Notes

Atoi and Itoa assume decimal and the Go int type. FormatBool, FormatFloat, FormatInt, and FormatUint go the other way, from values to strings.

## Reference list

- `strconv` converts to and from string representations of basic data types.
- `Atoi` converts a string to int; Itoa converts an int to a string.
- `ParseBool` ParseFloat, ParseInt, and ParseUint convert strings to values.

## See also

- [go-slices](https://iinventedlight.com/library/notes/go-slices/)
- [go-error-handling](https://iinventedlight.com/library/notes/go-error-handling/)
- [go-modules-basics](https://iinventedlight.com/library/notes/go-modules-basics/)

## Claims

- id: C1
  claim: strconv converts to and from string representations of basic data types.
  source: S1
  evidence: "Package strconv implements conversions"

- id: C2
  claim: Atoi converts a string to int; Itoa converts an int to a string.
  source: S2
  evidence: "The most common numeric conversions are [Atoi] (string to int) and [Itoa] (int to string)"

- id: C3
  claim: ParseBool, ParseFloat, ParseInt, and ParseUint convert strings to values.
  source: S2
  evidence: "[ParseBool], [ParseFloat], [ParseInt], and [ParseUint] convert strings to values"

## Sources

- [S1] strconv package. Go docs. https://pkg.go.dev/strconv . License: BSD-3-Clause. Accessed 2026-11-18.

- [S2] doc.go. Go source. https://raw.githubusercontent.com/golang/go/master/src/strconv/doc.go . License: BSD-3-Clause. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go docs, strconv package; Go source, doc.go. 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).
