Convert TXT to ASCII
Convert a plain-text file to strict 7-bit ASCII without mistaking extensions or ANSI for encoding.
Convert TXT files online
We don’t have a dedicated online converter for TXT to ASCII yet, but you can convert TXT files online to these and more formats:
How to convert txt to ascii file
- Text files
- No ratings yet.
A legacy application, serial device, import routine, or source-control rule may reject UTF-8 and accept only 7-bit ASCII. The conversion changes character encoding and may require replacing characters that ASCII cannot represent.
What TXT files contain
TXT is a filename extension for plain text, not a fixed character encoding. Text editors, log exporters, developers, and office users create .txt files in UTF-8, UTF-16, Windows-1252, and other encodings.
A file called notes.txt is therefore not automatically ASCII. UTF-8 is the usual current default because it supports accented letters, typographic punctuation, non-Latin scripts, and emoji.
What ASCII means
ASCII is a 7-bit character set with 128 values, represented by bytes 0x00 through 0x7F. It supports English letters, digits, basic punctuation, tabs, and control characters such as carriage return and line feed.
ASCII cannot represent characters such as é, —, £, curly quotes, Cyrillic, Chinese characters, or emoji. Its advantages are predictable one-byte characters and compatibility with systems that explicitly require 7-bit input.
ASCII is an encoding, not a distinct text-file format. A receiver may require an .asc, .ascii, or .txt filename, but changing the extension alone does not change the file bytes.
Convert with strict error checking
Identify the source encoding from the program that created the file whenever possible. On macOS or Linux, file -bi input.txt can provide a useful hint, but its result is not definitive.
On macOS or Linux, use iconv to stop when the input contains an unrepresentable character:
iconv -f UTF-8 -t ASCII input.txt -o output.txt
Replace UTF-8 with the actual input encoding when needed, for example WINDOWS-1252, UTF-16LE, or UTF-16BE. A failed command can leave a partial output file; check its exit status and discard the output on failure.
Python provides the same strict conversion on Windows, macOS, and Linux:
python -c "from pathlib import Path; s=Path('input.txt').read_bytes().decode('utf-8-sig'); Path('output.txt').write_bytes(s.encode('ascii'))"
This command accepts UTF-8 with or without a UTF-8 byte-order mark and raises an error instead of silently changing unsupported characters. Change utf-8-sig only after confirming that the source uses another encoding.
Use Visual Studio Code or another editor to inspect and edit the source, then run the conversion locally from its integrated terminal. Visual Studio Code can also use View → Command Palette → Change File Encoding → Save with Encoding and an ASCII option where available, but editors may substitute unsupported characters rather than fail; use a strict command for identifiers, records, and other exact data.
Choose substitutions deliberately
If changed text is acceptable, GNU iconv can attempt transliteration:
iconv -f UTF-8 -t ASCII//TRANSLIT input.txt -o output.txt
Transliteration may convert é to e and typographic quotes to straight quotes. Results vary by operating system and library, and characters without a sensible substitute can still be omitted or cause an error. For controlled data, replace characters explicitly before conversion and review every change.
Do not use Windows Notepad's Save As → ANSI setting as an ASCII conversion. “ANSI” usually means the active Windows code page, such as Windows-1252, which permits bytes above 0x7F.
Check target compatibility
Confirm that the receiving system actually requires 7-bit ASCII, rather than Windows-1252, “ANSI,” or an unspecified extended ASCII code page. Extended ASCII is not a single standard; the same byte can mean different characters in different code pages.
Check the output for altered punctuation, removed symbols, field-width changes, and required line endings. ASCII text normally uses LF on Unix-like systems and CRLF on many Windows-oriented imports; encoding conversion does not necessarily change them. Strict ASCII output must not include a UTF-8 byte-order mark.
Most upload-based TXT converters do not clearly state their output encoding or replacement policy. For sensitive files or strict imports, use local tools; use an online service only when it explicitly offers US-ASCII output, documents its handling of unsupported characters, and its privacy policy permits the upload.
Suggested software and links: txt to ascii converters
Frequently asked questions
What happens to accented letters when converting TXT to ASCII?
Characters outside the 7-bit ASCII range, such as accented letters, emoji, and many non-Latin scripts, cannot be represented and may be removed, replaced, or transliterated. Check the result if those characters matter.
Does converting TXT to ASCII change the text formatting?
Plain text formatting such as line breaks, spaces, and tabs is generally preserved, but ASCII cannot store rich-text styling, embedded images, or other document features. The result remains editable as plain text.
Why do some TXT files fail when converted to ASCII?
The source may use UTF-8, UTF-16, or another encoding rather than 7-bit ASCII, and interpreting it with the wrong encoding can produce garbled characters. A strict ASCII conversion must identify or correctly decode the source encoding before removing unsupported characters.
Will an ASCII file be smaller than the original TXT file?
It may be smaller when the TXT file contains multibyte characters, but the difference depends on the text and its original encoding. Converting the extension alone does not change the file contents or encoding.