To convert ASCII to a char in Python, pass a decimal code from 0 through 127 to chr(code). This is the complete one-value conversion: chr() returns the character assigned to that numeric code point, and standard 7-bit ASCII occupies values 0–127.
In Python, char is not a separate data type. The result of chr() is a one-character string, or str. The important distinction is that chr() is not restricted to ASCII; it can also return Unicode characters, so strict ASCII code should check the range before calling it.

How chr() and ord() map ASCII values
Python provides two complementary built-ins. Use chr() to turn an integer into a character and ord() to turn a one-character string into its numeric code point. For characters in the standard ASCII range, the result of ord() is the same as the character’s decimal ASCII value.
| Python operation | Direction | Scope and guardrail |
|---|---|---|
| chr(code) | Integer to one-character string | Accepts Unicode code points; check for 0–127 when strict ASCII is required. |
| ord(character) | One-character string to integer | Returns a Unicode code point, which matches the ASCII value for ASCII characters. |
| "".join(chr(code) for code in codes) | Integer sequence to text | Joins the one-character results after every code has been validated. |
| bytes(codes).decode("ascii") | Byte sequence to text | Use for actual bytes; the ASCII decoder rejects non-ASCII bytes. |
Standard ASCII assignments are defined by IETF RFC 20. Those numeric assignments agree with Unicode for the ASCII range, but a Python character outside that range should not be relabeled as extended ASCII without knowing the source encoding.
Convert decimal ASCII codes to characters in Python
Start with a list of decimal codes stored as integers. If the codes begin as text tokens, parse each one with int(token, 10) before validating or converting it.
Check that every integer is inside the standard ASCII range:
if any(code < 0 or code > 127 for code in codes):
raise ValueError("ASCII codes must be from 0 through 127")
Convert one validated value with character = chr(code). The result is a one-character Python string.
Convert a complete sequence by joining the individual characters:
text = "".join(chr(code) for code in codes)
Display or copy the resulting text. When it may contain control characters, inspect it with repr(text) so invisible tabs, line feeds, and other controls are shown as escapes.
No import is needed for this approach because both chr() and join() are built in.
Decode a complete decimal sequence
For one worked example, begin with this list of codes:
codes = [72, 101, 108, 108, 111]
Each item passes the ASCII range check. Applying chr() to each code and joining the results without a separator produces:
Hello
The order of the list determines the order of the output characters. Calling chr() directly on the whole list will not work because it accepts one integer at a time.
Turn ASCII text back into decimal values safely
Although ord() handles Unicode as well as ASCII, it can silently return a value above the ASCII boundary for a non-ASCII character. Validate the text if the result must remain strict 7-bit ASCII:
def ascii_values(text):
values = []
for position, character in enumerate(text, start=1):
value = ord(character)
if value < 0 or value > 127:
raise ValueError(f"Non-ASCII character at position {position}")
values.append(value)
return values
This reports the first out-of-range character instead of turning it into UTF-8 bytes or assigning it an arbitrary legacy code-page value. The position is one-based because enumerate(..., start=1) is used.
Keep characters, bytes, and controls straight
chr() returns text, not a byte. When an API, file, or protocol expects bytes, encode the resulting text explicitly with text.encode("ascii"). Python’s ASCII encoder rejects characters outside the standard range, while bytes(codes).decode("ascii") is appropriate when the source is already a sequence of bytes.
ASCII is a 7-bit standard, although Python byte objects are 8-bit containers. Decimal values from 0 through 31 and 127 represent control characters rather than ordinary visible symbols. A tab or line feed may affect layout, while other controls can appear blank. Copying such characters into another application may trigger application-specific behavior, so retain the decimal codes or inspect the text with repr() when visibility matters.
Python’s ascii(text) built-in is also easy to confuse with this task. It produces a printable escaped representation of a string; it does not turn a decimal code into the character itself. The direct numeric-to-character operation remains chr().
Verify a conversion in the browser
The ASCII Converter provides a no-code way to check a decimal sequence or confirm the reverse text-to-codes result. It performs the same bounded two-way conversion locally in the current browser tab; it is not a replacement for the Python function when your application needs executable code.
Open the ASCII Converter and choose codes-to-text to decode decimal ASCII values.
Enter decimal values from 0 through 127, separating them with spaces, commas, or line breaks.
Select Convert ASCII.
Review the output for invisible control-character implications, then copy the result if needed.
In the opposite text-to-codes mode, the tool returns space-separated decimal integers. Its text input is limited to 100,000 UTF-16 code units, while decoding accepts at most 50,000 codes. Text encoding rejects the first character outside 7-bit ASCII and reports its position. Decoding requires plain unsigned decimal integers and rejects signs, fractions, hexadecimal prefixes, empty tokens, and values above 127. Encoding, decoding, and validation remain in the browser tab, so the supplied text is not uploaded.
Use a named encoding for non-ASCII data
chr() can represent Unicode code points, but that does not make the result an ASCII conversion. Unicode text, emoji, UTF-8 bytes, and legacy code-page data each require different rules. For example, data known to contain UTF-8 should be decoded with data.decode("utf-8"), while legacy data must use the encoding named by its source. Values from 128 through 255 have no universal “extended ASCII” meaning, so do not decode them until the source encoding is known.
Avoid common Python conversion mistakes
Do not use str(code) for the conversion. It creates a decimal text representation, not the character assigned to that code.
Do not pass a list directly to chr(). Validate the list and join the individually converted characters.
Do not assume chr() enforces ASCII. Add an explicit 0–127 check when that boundary matters.
Do not treat bytes and text as interchangeable. Use encode("ascii") or decode("ascii") at the byte boundary.
Do not ignore invisible controls. Use repr() to inspect output before copying it into another system.
For a deeper look, see ROT13 Decoder Python: Stdlib and Manual Methods.