ASCII Table for C Programming: Control Codes & Printable Byte Chart

An interactive ascii table is an indispensable reference when debugging character encoding, serial UART streams, or string parsing routines in C. C stores characters as integer byte values in char variables, so by looking at an ascii table these can be mapped to control codes (0-31, like newline 10 and carriage return 13), printable symbols, digits (48-57 for '0' to '9'), uppercase letters (65-90 for 'A' to 'Z'), and lowercase letters (97-122 for 'a' to 'z'). Fast case-conversion bitwise masks, such as c ^ 0x20, and checking if the input buffer is a valid one (without magic numbers) can be done using exact decimal and hexadecimal values from the ascii table.

Interactive ASCII Table: Decimal, Hex, Octal & C Escape Sequences — Technical Overview

An interactive ascii table is an indispensable reference when debugging character encoding, serial UART streams, or string parsing routines in C. C stores characters as integer byte values in char variables, so by looking at an ascii table these can be mapped to control codes (0-31, like newline 10 and carriage return 13), printable symbols, digits (48-57 for '0' to '9'), uppercase letters (65-90 for 'A' to 'Z'), and lowercase letters (97-122 for 'a' to 'z'). Fast case-conversion bitwise masks, such as c ^ 0x20, and checking if the input buffer is a valid one (without magic numbers) can be done using exact decimal and hexadecimal values from the ascii table.

#include <stdio.h>

int main(void) {
    char upper = 'A';
    char lower = upper ^ 0x20; /* Toggle ASCII bit 5 */
    printf("Char '%c' -> Dec: %d, Hex: 0x%02X\n", upper, upper, (unsigned char)upper);
    printf("Char '%c' -> Dec: %d, Hex: 0x%02X\n", lower, lower, (unsigned char)lower);
    return 0;
}

Runnable C example

#include <stdio.h>

int main(void) {
    char upper = 'A';
    char lower = upper ^ 0x20; /* Toggle ASCII bit 5 */
    printf("Char '%c' -> Dec: %d, Hex: 0x%02X\n", upper, upper, (unsigned char)upper);
    printf("Char '%c' -> Dec: %d, Hex: 0x%02X\n", lower, lower, (unsigned char)lower);
    return 0;
}

Open example in compiler

Expected Output

Char 'A' -> Dec: 65, Hex: 0x41
Char 'a' -> Dec: 97, Hex: 0x61