Article · Wikipedia archive · Last revised May 31, 2026

Iconv

In Unix and Unix-like operating systems, iconv is a command-line program and a standardized application programming interface (API) used to convert between different character encodings. "It can convert from any of these encodings to any other, through Unicode conversion."

Last revised
May 31, 2026
Read time
≈ 2 min
Length
568 w
Citations
14
Source
iconv
Original authorHewlett-Packard
DevelopersVarious open-source and commercial developers
Operating systemUnix, Unix-like, Microsoft Windows, IBM i
PlatformCross-platform
TypeCommand
Licenselibiconv: LGPL
iconv: GPL
win-iconv: Public domain1
Repositoryhttps://git.savannah.gnu.org/git/libiconv.git

In Unix and Unix-like operating systems, iconv (an abbreviation of internationalization conversion)2 is a command-line program3 and a standardized application programming interface (API)4 used to convert between different character encodings. "It can convert from any of these encodings to any other, through Unicode conversion."5

History

Initially appearing on the HP-UX operating system,6iconv() as well as the utility was standardized within XPG4 and is part of the Single UNIX Specification (SUS).

Implementations

Most Linux distributions provide an implementation, either from the GNU Standard C Library (included since version 2.1, February 1999), or the more traditional GNU libiconv, for systems based on other Standard C Libraries.

The iconv function7 on both is licensed as LGPL, so it is linkable with closed source applications.

Unlike the libraries, the iconv utility is licensed under GPL in both implementations.8 The GNU libiconv implementation is portable, and can be used on various UNIX-like and non-UNIX systems. Version 0.3 dates from December 1999.

The uconv utility from International Components for Unicode provides an iconv-compatible command-line syntax for transcoding.

Most BSD systems use NetBSD's implementation, which first appeared in December 2004.

The musl C library implements the iconv function with support for all encodings specified by the WHATWG Encoding Standard.

Support

Currently, over a hundred different character encodings are supported in the GNU variant.5

Ports

Under Microsoft Windows, the iconv library and the utility is provided by GNU's libiconv found in Cygwin9 and GnuWin3210 environments; there is also a "purely Win32" implementation called "win-iconv" that uses Windows' built-in routines for conversion.11 The iconv function is also available for many programming languages.

The iconv command has also been ported to the IBM i operating system.12

Usage

stdin can be converted from ISO-8859-1 to current locale and output to stdout using:13

iconv -f iso-8859-1

An input file infile can be converted from ISO-8859-1 to UTF-8 and output to output file outfile using:

iconv -f iso-8859-1 -t utf-8 <infile> -o <outfile>
See also

See also

References

References

  1. "win-iconv/readme.txt at master · win-iconv/win-iconv · GitHub". GitHub. Archived from the original on 9 August 2022. Retrieved 20 December 2020.
  2. "R: Convert Character Vector between Encodings". astrostatistics.psu.edu. Archived from the original on 31 October 2020. Retrieved 21 April 2018.
  3. "iconv". pubs.opengroup.org. Archived from the original on 28 October 2020. Retrieved 21 April 2018.
  4. "iconv". www.opengroup.org. Archived from the original on 8 December 2010. Retrieved 21 April 2018.
  5. "libiconv - GNU Project - Free Software Foundation (FSF)". www.gnu.org. Archived from the original on 1 May 2018. Retrieved 21 April 2018.
  6. "iconv(3C)". docstore.mik.ua. Archived from the original on 7 December 2019. Retrieved 21 April 2018.
  7. "glibc: iconv/iconv.c". Archived from the original on 19 January 2025. Retrieved 30 November 2016.
  8. "glibc: iconv/iconv_prog.c". Archived from the original on 19 January 2025. Retrieved 30 November 2016.
  9. "Cygwin Package Search: libiconv". Retrieved 30 November 2016.{{cite web}}: CS1 maint: deprecated archival service (link)
  10. "LibIconv for Windows". gnuwin32.sourceforge.net. Retrieved 21 April 2018.
  11. "win32-iconv". GitHub. Archived from the original on 9 January 2017. Retrieved 30 November 2016.
  12. IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Archived (PDF) from the original on 18 September 2020. Retrieved 5 September 2020.
  13. "IBM Knowledge Center". www-01.ibm.com. Archived from the original on 5 March 2016. Retrieved 21 April 2018.
External links