# Beginner's Guide to Coding and Data

Level: Beginner

## Text to Binary explained | Introducing bits and bytes for programming beginners

### video

expand_more chevron_left

### text

expand_more chevron_left

### Text to Binary Transformation

So, how do we transform the text, like `deeplizard`, into its binary form? We'll walk through the ins and outs.

In order to nail this concept down, we need to use the following foundational topics:

• Character Encoding
• Positional Numeral Systems

If you stumble upon any difficulties, don't hesitate to review the lessons on character encoding and positional numeral systems. They'll pump up your knowledge on the subject.

#### The Transformation Process

We'll take the example of the text deepLizard and show how it converts to binary. The transformation involves two crucial steps:

1. Convert each character to its Unicode character code
2. Transform each base-10 code to its base-2 binary form

#### Under the Hood of Computers

In essence, computers only deal with numbers. By under the hood, we mean the hardware part of the computer. When we talk about numbers, we're referring to numerals based on the binary positional numeral system.

Therefore, it's crucial for us as programmers to understand that all data, be it text or numerical, is ultimately translated to binary for hardware processing.

#### Bits and Bytes

Each binary numeral consists of `8` digits, which we call bits. A bit can either be `0` or `1`, representing the states off and on respectively.

A sequence of `8` bits is known as a byte. For example, the text deepLizard is represented as `10` bytesβone byte for each character.

#### A Practical Exercise

Give it a try. Open a text editor, type in deepLizard, and save the file. Check its properties, and you'll find it takes up `10` bytes of space.

It's fascinating to see how text representation can sometimes require more than one byte per character, depending on the encoding scheme.

### quiz

expand_more chevron_left

### resources

expand_more chevron_left

expand_more chevron_left