ASCII Space Character

The space character (ASCII code 32) is the most commonly used character in text. It separates words and creates readable content. Despite being "invisible," it's crucial for text formatting and programming.

Space Character Visualization

The space character is invisible, but here's how it appears between words:

HelloWorldExample

Red dashed boxes represent space characters

Character Information

Property Value
ASCII Code (Decimal) 32
ASCII Code (Hexadecimal) 20
ASCII Code (Binary) 0100000
Unicode U+0020
HTML Entity   or  
URL Encoding %20
Character Type Printable, Whitespace

Programming Examples

JavaScript

// Creating space characters
let space = ' '; // Single space
let spaceCode = String.fromCharCode(32); // From ASCII code
let spaceHex = '\x20'; // Hexadecimal escape
let spaceUnicode = '\u0020'; // Unicode escape

// Working with spaces
let text = "Hello World";
let words = text.split(' '); // Split on spaces
let trimmed = text.trim(); // Remove leading/trailing spaces

Python

# Creating space characters
space = ' ' # Single space
space_code = chr(32) # From ASCII code
space_hex = '\x20' # Hexadecimal escape

# Working with spaces
text = "Hello World"
words = text.split(' ') # Split on spaces
trimmed = text.strip() # Remove leading/trailing spaces

C/C++

// Creating space characters
char space = ' '; // Single space
char space_code = 32; // From ASCII code
char space_hex = '\x20'; // Hexadecimal escape

// Working with spaces
printf("Hello%cWorld", space); // Print with space
if (ch == ' ') { // Check for space
    // Handle space character
}

Common Uses

  • Word Separation: Primary use in all written text
  • Code Formatting: Indentation and spacing in programming
  • Data Parsing: Delimiter in space-separated values
  • URL Encoding: Encoded as %20 in web URLs
  • String Processing: Trimming, splitting, and joining operations
  • Text Alignment: Creating columns and formatting

See also