iconv(1)

iconv1

Codeset conversion utility

Usage

iconv [-cs] -f from_name -t to_name [file ...]

iconv -f from_name [-cs] [-t to_name] [file ...]

iconv -t to_name [-cs] [-f from_name] [file ...]

iconv -l

Overview

The iconv utility converts the codeset of file (or from standard input if no file is specified) from codeset from_name to codeset to_name and outputs the converted text on standard output.

The following options are available:

-c

Prevent output of any invalid characters. By default, iconv outputs an “invalid character” specified by the to_name codeset when it encounts a character which is valid in the from_name codeset but does not have a corresponding character in the to_name codeset.

-f

Specifies the source codeset name as from_name.

-l

Lists available codeset names. Note that not all combinations of from_name and to_name are valid.

-s

Silent. By default, iconv outputs the number of “invalid characters” to standard error if they exist. This option prevents this behaviour.

-t

Specifies the destination codeset name as to_name.

Exit status

The iconv utility exits 0 on success, and >0 if an error occurs.

Examples

Convert file.txt from IBM273 to UTF-8 and save the result to converted.txt:

iconv -f IBM273 -t UTF-8 file.txt > converted.txt

Releases

30 releases since FreeBSD 10.0-RELEASE; the text changed 16 times.

  1. 10.0
  2. 10.1
  3. 10.2
  4. 10.3
  5. 10.4
  6. 11.0
  7. 11.1
  8. 11.2
  9. 11.3
  10. 11.4
  11. 12.0
  12. 12.1
  13. 12.2
  14. 12.3
  15. 12.4
  16. 13.0–13.2
  17. 13.3–16.0

Standards

iconv conform to IEEE Std 1003.1-2008 (“POSIX.1”).

History

iconv first appeared in NetBSD 2.0, FreeBSD 9.0.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.