If it is assigned in a English class, and it is called an "essay," and it is on a non-fiction topic, and it is not "creative writing," and it is not specifically called an "informal essay," then it is "formal."
"Formal English" means the correct, standard English you are learning in your classroom. If you are unsure about specific words, use a dictionary. If it identifies the word as "informal," "colloquial," "nonstandard," or "slang," don't use it.
Song lyrics are often in informal English.
News stories in newspapers and magazines are usually in formal English. Textbooks, encyclopedias, and nonfiction are usually in formal English. Wikipedia is in formal English. The magazine "The Economist" is written in excellent, formal English. So are "The New Yorker" and "The Atlantic."
In a novel, or other pieces of fiction, often the words in quotation marks--directly spoken by the characters--are informal, while the author's words telling the story are formal. However, some writers like to use an informal style, as if they were telling a story out loud to the reader.
This is a quotation from "The Adventures of Tom Sawyer," by Mark Twain:
'Mary gave him a tin basin of water and a piece of soap, and he went outside the door and set the basin on a little bench there; then he dipped the soap in the water and laid it down; turned up his sleeves; poured out the water on the ground, gently, and then entered the kitchen and began to wipe his face diligently on the towel behind the door. But Mary removed the towel and said:
“Now ain’t you ashamed, Tom. You mustn’t be so bad. Water won’t hurt you.”'
The first sentence is formal. Notice that it is fairly long and contains various pieces of punctuation including commas and semicolons. Mary's words are informal. They contain a word, "ain't," which dictionaries identify as "nonstandard." The phrase "Water won't hurt you" is perfectly correct English, but is informal because it has a slightly joking or teasing quality to it.