Code to Text Ratio: Master SEO with a Perfect Balance (2024 Guide)

03/28/2024 12:00 AM e Admin e Seo tools


Understanding the Code-to-Text Ratio: A Guide to SEO Optimization

1. Importance of code to text ratio for SEO

HTML stands for Hyper Text Markup Language. It is a type of computer language that is primarily used for files that are placed on the internet. These languages are not understood by common people who are internet users as well as web surfers. This may pose a main problem for SEO and Internet marketing. The greatest importance of this type of code for SEO is that it is very easy to understand for the search engine spiders. By its very nature and simplicity, search engine spiders are able to scan through HTML code much more easily and faster. JavaScript and embedded Flash or video is run by browsers to be understood but it's not always consistent, the technology to translate these languages into ones that are readable and viewable by search engine spiders has yet to be perfected and is constantly changing. This is not purely a downfall for SEO, if technology develops which can read audio or video content, SEO may be revolutionized completely. A current problem however is that search engines rely heavily upon how much keyworded text is relevant to the search. Video, audio and Flash content often doesn't carry textual search phrases within the file itself. Written scripts for videos can be keyworded but there is no effective way at this moment to force search engines to find and associate video or audio files with their written script. Flash files may also contain text but this is also more difficult to keyword due to the text within Flash also being contained as another type of code and not directly an image. Video and audio descriptive text can be considered less important to the visual or hearing impaired, sometimes a text alternative or transcript can offer an alternative approach to SEO. These are just some of the future strategies that can be taken into account for multimedia SEO, but a current best practice is to strike a good balance between media and text.

1.1. Improve search engine visibility

When a search engine indexes, it reads pages, looking for content to establish relevance and ultimately determine how high in the engine's results listing the page will be placed. A page consisting of all images has nothing for the search engine to read. The content of the images can be established via alt tags, but the page will likely be deemed less relevant compared to a similar page with a high text to code ratio. Considering the all important but often elusive number one spot, every little thing helps and this is very achievable even in competitive sectors with limited off page campaign effort. Creating a good text to code ratio is an integral part of search engine visibility. Search engines aren't too keen on what is they call "over optimization". This is a common practice done by webmasters aimed to manipulate search engine rankings. Often this is considered to be a one way ticket to getting a site de-indexed. Squeezing in those last few keywords can be detrimental to a site's ranking. A high keyword density could also significantly skew the on page theme. This could affect other pages within the site intended for a similar theme. High keyword density pages often give the impression of spam to the user, and search engines are able to establish semantic similarity between words, so the primary keyword doesn't necessarily need to be explicitly repeated again and again. By removing the code that has no visual impact, the remaining relevant textual content can be adjusted to reflect the intended on page theme, without skew.

1.2. Enhance website loading speed

There is something in web site development that creates a love-hate relationship. It's something that a lot of developers do, but at the same time, a lot of developers don't actually like doing it. It's code optimization. Now I am not talking about taking your CSS and running it through all of those compressors to shrink file size, or taking the entire markup of the page and thinly slicing it into a table hell. I am talking about how best to write and organize your code. Code optimization has always been somewhat of a black art, and the goal posts have been forever changing. These days with high-speed connections and people accessing websites on high-spec hardware from around the globe, it can be argued that it's less important than it used to be. But one area where code optimization still has an impact is with mobile web, and with the variety of different quality devices that are commonly used to access websites. It's now more important than ever to make sure that the code you are writing is as efficient as possible. This is so that it runs well and is easily maintainable, to make better use of limited connection speeds as to reduce the size of the web pages being served and data used, and to make sure that websites and web apps are compatible with as many devices as possible. Writing efficient code will, in turn, create a more efficient user experience.

1.3. Increase user experience

Increase user experience is a key goal for any website. To achieve this, the website's content and presentation need to attract and retain the user's attention. Search engines such as Google want to provide users with the best possible results. Those that are fast and have relevant content undoubtedly provide a better experience. This likely has an effect on search engine rankings and may, to some extent, be taken into consideration in search engine algorithms. A slow website can have a negative impact on user experience and also potentially affect search engine rankings. User experience is also affected by how quickly users can find the information they were looking for. A website with lots of content can sometimes be difficult to navigate. This is sometimes caused by the presentation of information being spread across numerous pages. If the same amount of information can be offered in a more concise format, using fewer pages, then it will be easier for users to find what they are looking for. Usually, the ratio of links to the amount of content will also be higher on a page with dense content, providing users with a better choice of where to go next. Linking is a key search engine-friendly method for getting all available information indexed. Users may also just not want to read a lot of information and would prefer to quickly summarize or scan read. Having enough textual content for search engine indexing and more detailed content available must be balanced with what is most convenient for the user.

2. How to calculate the code to text ratio

The separation of code and text in a file is reasonably coherent to define and implement. A single line of code has many possible text content (for instance commenting on that line or simple instruction to a variable), but for the purpose of the code to text ratio, we will only class comments to be the text content. This is a simplification, and sometimes a comment can be an explanation of a line of code, in which case it should be weighed with the code itself. However, those cases are highly subjective, and in the bulk of cases, comments are separate from the code they are a reference. Furthermore, any string literals in the code can be classified as text content. In this case, it would be best to separate code from text in a file by counting all lines which have text content [L_T]. This includes lines of code and lines of comments in the code. Then we define lines consisting of just code to be [L_C], and lines with just comments or text to be [L_TXT]. The density of code per text can later be simply defined as the amount of lines of code divided by the amount of lines of text in the file overall, that is [L_C]/[L_T]. Counting lines of code and text is an easily automatable task. By simple line-by-line parsing of the entire file with any kind of script code, text can be differentiated from comments and string literals by the starting symbols and formatting that is inherent to any programming language. All non-whitespace text from // or # to the line end or enclosed by /* and */ in the case of C-derivative languages is a comment. For a more complex definition of text content, one might implement a parser for the programming language used. Lines of code are simply lines left over with something other than whitespace after the comments have been taken out, and lines of text can be defined as the lines with text content left over after lines of code (and potentially string literals) have been taken out. A more thorough but somewhat complex idea would be to identify and separate lines of code into an abstract flowchart/script structure. An alternative method would be to paste the code into a word processor and use the word count tools. This is less flexible and is not so good if the code is split across many different files.

2.1. Counting the lines of code

Blank lines and comment lines are simple to distinguish from code lines as there is no program logic in a blank line and there is no code that actually performs a task in a comment line. However, we are focusing on counting the quantity of lines in the code to complete a functional task, so we must decide whether to count lines of code within control structures and conditional statements when the program is translated from one language to another. To maintain our standard of LOC for changes in the code, it would not be logical to count lines of conditional statements and control structures of languages such as Java and C++ as equivalent to lines of the same functional nature but written in a language with fewer lines of syntax, e.g. assembly language. Therefore, it is more useful to count lines of a high-level language equivalent to their function in pseudocode or lines of similar function in the standard it was written, to make sure that changes to the program still affect the result of LOC.

Two software developers might hear about LOC and what they understand could be totally different. One might think that LOC is the quantity of lines in the code of a given functional requirement, while the other might consider that LOC is the total number of lines in the entire code of a module. Due to the multiple interpretations of lines of code, we must first decide which statement defines LOC. Let's consider the definition of LOC to be "the quantity of lines in the code of a given functional requirement". This decision is to make sure that a standard is set when the LOC of a program is measured and changes to the program do not affect the result of LOC. Now that the definition of LOC has been decided, we need to determine which lines of a particular file of code are to be counted towards reaching LOC.

2.2. Determining the total text content

Determining the total text content: Below a line of code is a comment describing the line of code. How do we decide whether the comment is code or text? For the purpose of this tool, we need to differentiate between code and text. To decide if a line is code or comment, the tool works from the start of the file to the end and checks each character. The tool keeps a count of the number of open and close comment delimiters and it steps through each character one at a time. This is done so that the tool doesn't confuse commented code with comments on comment delimiters or comments midway through a line of code (sometimes called end of line comments). This method will correctly categorize lines of code and will correctly ignore lines that are entirely contained within comment or string delimiters, considering them to be text. Lines that are entirely contained within a single string delimiter are considered to be text. An alternative method of distinguishing between code and text is needed to count the number of character occurrences in the code that are open code delimiters that aren't closed. This method is useful for the purposes of comparing counts to check that your syntax highlighting of code delimiters is correct or to find and correct mismatching comment delimiters that may incorrectly cause some lines of code to be categorized as comments. This method correctly categorizes lines of code and differentiates between errors and intended comments; however, it may count a few extra lines of code if your code is badly written with comment delimiters midway through segments of code, but this is unlikely to have a significant effect on the overall counts.

2.3. Calculating the ratio

For example, given a simple program that contains 100 lines of code and 400 lines of text, a quick calculation shows that 100/(400+100) equals 0.2. If we were unsure of the acceptability of this value, we could multiply by 100 to give the percentage of code in the program. This shows us that a ratio of 0.2 is equal to 20% and is likely to be too text heavy when it comes to functionality and processing power. Using this simple formula and multiplying it by 100, you can follow the next tip.

The actual process of determining the ratio is simple once you have the amount of code and text. You can use our simple formula of Code/(Text + Code). This will give you a decimal number which represents the ratio between 1 and 0. Although it is widely recognized that a ratio of 0.7 or above is a good balance, any ratio under 0.5 is usually indicative of too much text, as the code will be lacking.

3. Tools to check the code to text ratio

The prior sections give a clear understanding about what code to text ratio is, and its significance in search engine rankings. Now as we are aware of why the ratio is important and what developers and webmasters have to work on, it is important to know how we can check the code to text ratio. There are various tools that help to check how efficient the web page code is, in terms of code to text ratio. In general, these tools check for the percentage of actual readable text on your web page. As the name suggests, these are the tools available online where you can just give the URL of the web page that needs to be analyzed. Some of these tools are free and some are paid. Online code to text ratio checkers analyze the given web page and give back the results instantly showing what the ratio is and what should be the ideal ratio. Some of these tools even give a detailed analysis on how the web page can be improved from the current status. These are browser plugins used with specific browsers, mainly Mozilla and Internet Explorer. Once installed, these plugins will give analysis of all the web pages being viewed in the browser. These help compare various indexed pages in a go at any website, helping to understand the efficiency of the current page compared to the old one and also the competitor's page. This is essential for SEO campaigns.

3.1. Online code to text ratio checkers

While the basic concept of code to text ratio provides insight into how much of the web page is readable text versus code, this does not automatically mean that a higher ratio is better. One may think that a high ratio is better because more text means more relevant content and possibly better rankings in search engines. This isn't true. For the search engines, especially Google, it is not exactly known what the best ratio is. It is only known that the search engine prefers that the web page's content be more relevant to its code. Relevant meaning that in comparison, there are fewer HTML tags and JavaScript functions, and more of what a user would read. This is so that the search engine can "understand" the page better, and in theory provide a higher ranking on the search results. So a high ratio with more text doesn't necessarily imply a higher relevance. The best indicator of relevance is a comparison between the code text and other visible text on the page. A ratio of 25% or lower is a good target to aim for. It has been suggested that a ratio between 15 to 20% is very good, although in view of the fact that search engines are always developing new algorithms, these numbers can only be approximate.

3.2. Browser extensions for code analysis

Firefox Web Developer is a toolbar that provides an easy, no-hassle way to check the code to text ratio of the currently viewed webpage. Clicking "Information" -> "View Document Outline" will display a table that includes the ratio as well as providing a basic visualization of the tags used. This can be helpful when trying to get an at-a-glance overview of the code's structure. It is probably not sufficient for detailed analysis, but might prove useful to some people.

Browser extensions are among the most convenient tools to check the code to text ratio. They are lightweight, effective, and easy to use. These extensions work by sending a request to the server, which analyzes the webpage and returns the results. Because the results are generated remotely, online code to text ratio checkers generally provide less detail than local analysis, but they do serve as a pretty good starting point for optimizing the content.

3.3. Code editors with built-in ratio calculation

Conclusion: Higher code to text ratio may lead to speedy development but lower page performance and vice versa. Generally, a code to text ratio of 15-20% is very healthy and provides the best mix of text as well as formatting tags. Any web page focusing on SEO should look to have an optimized code to text ratio. It is a very efficient way of working considering now that these tools simplify code to text ratio analysis. These tools remove the need for sending internet files to another source, instead the analysis is done directly while typing the code and thus the results are directly available for making on spot changes.

A code editor can be made more functional by incorporating a tool to check the code to text ratio while typing the code. Web CAVR (web content analysis with vast web-based results) tool was developed using Perl to check code to text ratio on a webpage. This GUI-based tool is very user-friendly and creates direct visual interpretation through a colored bar to illustrate code to text ratio. It allows users to input files and URLs as well as being able to analyze entire local directories of pages. This tool helps determine whether the text to code ratio is suitable and if changes need to be made. Web programmers may find this tool very useful because it specifically deals with the analysis of web programming pages. Code to text ratio optimizer is an online radio checking tool which helps in optimizing web pages for SEO. An optimal mix of code and text is used to make the page more search engine friendly. Code to text optimization ensures that a web page has enough keyword density without using different fonts and colors in a para. This tool helps in analyzing and modifying the code to get optimum text to code ratio for increasing the page rank.

4. Interpreting the results of the code to text ratio checker

In order to calculate the code-to-content ratio score, a numerical percentage score is given which ranges from 0 - 100%. A score over 100% is taken as 100%, and for most webmasters the ideal score will be between 20-70%. This indicates that there is a higher amount of visible text compared to code, which is a good target to aim for. If the percentage is too high, there may not be enough HTML code to enable the page to be displayed correctly. Also, some search engines may prefer to look at a broader range of text to HTML and if there is less HTML then there is less chance to include keywords which may affect search engine rankings. Whilst if the percentage is too low, this may be an indication of a page that is structured in an unfriendly way - for example it may contain too complex nested tables - which has an adverse effect on search engine rankings. The percentile of the score will give a good indication of the balance between code to text, yet if the score is not as desired the problem may not be immediately visible. This is where the breakdown of the visible text, the HTML code and the text to HTML ratio comes in useful. By comparing with the percentile score, it will enable to make inferences on whether specific elements of the web page are effecting the code to text ratio. For example, a page may have a percentile score in the desired range, yet the text to HTML ratio and/or the amount of text may be below what is expected. This could mean that the page has a higher amount of text to visible code. By analysing specific components of the page it will give a clearer idea of what needs to be altered to give the desired code to text ratio.

4.1. Understanding the ideal code to text ratio range

Code to text ratio is ultimately a way for search engines to understand your website content. While working on the code to text ratio of a page, strive to reach the optimal range of 15-70%, but remember these percentages may not apply to every search engine. The optimal rate of 25-65% will yield better results on newer search engines such as Google, while the 15-70% will yield better results on older search engines such as Yahoo. When you apply these rules, it is possible to get better rankings on search engines that support search engine optimization. A website with a higher ranking will be visited more often. Visitors can turn into revenue for your website, whether you are selling a product, service, or providing information. A higher rank on a search engine can also improve your company's branding. With a higher rank on the search engine, your website and company will have a better image and be more recognizable.

4.2. Identifying potential issues or areas for improvement

Potential areas for improvement or issues would be any page that falls within the parameters of being over 15kb, having a code to text ratio less than 15:1 or over 100kb, have a text body consisting of less than 50 words, or alt image tags. If you input your URL into the spider and find that there are some pages which contain over 15kb worth of text, you may want to consider breaking that page into two pages. This can help your download time and most certainly improve the code to text ratio. The same can be said for pages with an excessive amount of code and or pages containing an abundant amount of text positioned inside of HTML tables. If an Alt image tag is the issue, you can simply revise the tag so that it contains some of the key words found in the midst of the text on the page in question. Overall, this could be a very crucial finding leading a person to seriously reconsider the entire makeup of their webpage. If a page is not search engine friendly, which would most likely be concluded if it holds a poor code to text ratio, it must be revised if search engine traffic is of importance. One tip would be to redo the page or pages in question and then re-enter the URL of the page into the code to text ratio checker to see if results have improved. Over time, if you manage to revise the problematic pages, you should see an increase in search engine traffic to the revised pages. An increase in traffic could possibly signify that you are now getting a higher amount of organic traffic as a result of the newly search engine optimized pages.

4.3. Analyzing the impact on SEO performance

When interpreting the results of your code to text ratio analysis, it is important to consider the tangible impact on your website. The significance of the ratio is in how search engines tend to see the website. The closer to the ideal ratio you are, the more likely your website is to be seen in the way it was designed. It should be noted however that correlation and causation are two different things. Just because a ratio is above or below the ideal range does not mean it will directly cause the website to be seen in a certain way on its respective search engine. This may in fact be a result of other on-page factors. Nevertheless, it is important to be aware of how changes in the ratio may have affected the website's visibility in search engines. If you have a very high ratio, it is likely that your web page appears 'spammy' to the search engine. This may prompt the search engine to lower your page rank, or in severe cases issue a ban. A low ratio would indicate that the web page may not rank for keywords it wants to due to the search engine seeing it as an image or media file. This is particularly common in flash-based websites. In both cases, the webmaster should consider whether the current ratios match up to the way in which they want their site to be indexed in search engines, and act accordingly. Remembering again that there are other factors which may have affected the site's search engine visibility.

5. Tips to improve your code to text ratio

5.3. Compressing images and optimizing media files While complementary to compression, the usage of smaller media files and images will have a greater effect in terms of increasing the code to text ratio. Dynamic HTML menus can easily replace image-based counterparts with smaller media files. With images, however, the usage of Graphics Interchange Format (GIF) or Portable Network Graphics (PNG) software, images can be saved at a smaller file size without losing their prominence.

5.2. Utilizing CSS and JavaScript external files Styling elements can take up a lot of room in terms of HTML, which will lower your code to text ratio. The speediest solution is to use an external CSS file, which will allow for increased flexibility and a reduced document weight. Additionally, JavaScript can be used in place of various HTML attributes and tags such as the image rollover attribute.

5.1. Minimizing unnecessary HTML markup Extra HTML markup, such as lengthy image descriptions, comments, and excessive spaces can increase the size of your webpage. In order to strip out unneeded markup (such as multiple spaces and extra lines), you need to process the code through a server-side language. This will remove any incidental markup throughout the code, but be sure to keep a backup before doing this. Also, replacing image buttons with text will also increase your code to text ratio.

To obtain build content that is highly legible with a good code to text ratio, here are a few tips to maximize your content's delivery. These tips will also improve generic website performance!

5.1. Minimizing unnecessary HTML markup

Unnecessary HTML markup refers to using HTML tags that are not required to serve the intended purpose. This section is perhaps the most important in the essay in guiding authors towards the right path. Authors often go for unnecessary complications when the simple solution can suffice. At the end result, the web page has way too much code and is often convoluted. It is important for authors to understand that the more HTML there is, the less content there is in relation when text is split into code and text. This is because excessive code can drown out the actual content. It is often said that less is more and this maxim is certainly true in this context. It is important for authors to ask themselves if the HTML being used is necessary and if there is a more simple and efficient solution. When marking up an HTML document, one must always keep in mind the available tags in the HTML specifications. A common mistake for authors is not consulting the specification and to rely on advice from word of mouth or just what is perceived to be correct. This has resulted in malformed HTML documents that "work fine" in certain browsers but give unexpected results in others. Often when trying to achieve a particular effect, the author is not aware that there is a dedicated tag designed for just that. An adequate understanding of HTML and the correct tags to use certainly decreases the amount of code required.

5.2. Utilizing CSS and JavaScript external files

External files include CSS and JavaScript files that enable you to separate structure from function and degrade gracefully. This has the advantage of making your code easier to maintain and also allows you to apply the same style across multiple pages of your site. This is because with an external CSS file, you can change the look of an entire site by altering one file. Before you begin, the disadvantage is that there can be a latency period in downloading external files which can disrupt the user experience and give a poor perception of site load time. You can use a <link> tag in order to link to an external CSS file and a <script> tag to link to your JavaScript file. An example of this can be seen in the code snippet below. This method is more advanced and is recommended for more experienced developers looking to improve their code to text ratio. It is also recommended that you have a good understanding of how your server handles cache directives, if at all. A recent W3C draft also defines a new language for the inclusion of CSS and XML within an XHTML or HTML document. The basic module contains various attributes for specifying the location of the file to include, for styling the include itself, and for specifying alternate style sheets for non-graphical browsers. This can be an interesting technique in the future of web design, but should be used with caution as it is not yet a stable method and the use of experimental code in a live environment can sometimes have unexpected results.

5.3. Compressing images and optimizing media files

To minimize the size of documents and web pages, the authors of HTML, CSS, and JavaScript often neglect quality, so they can have a smaller file size. While the best way to reduce file size is to avoid including too much unnecessary content, there are some general methods and specific techniques that can be used to compress the data further. A very effective method of compressing data is to simply reduce the overall amount of data that needs to be loaded. Increasingly, and especially in the case of images and media, a significant increase in CPU power and network speed has resulted in developers only considering multiple images in the form of slideshows or galleries, compared to using content for image generation or data in past times. So quite often the best method to reduce data size is to simply replace the image or media content with a pure CSS or JavaScript generated equivalent. Another method to reduce the size of webpage and document content is simply to reduce the amount of images and media used. While it might seem simple at a glance, some regular routine image usage can be replaced with smaller and less complex equivalents. Borders and backgrounds are a particularly good example of this; with no loss in visual quality, they can be replaced with images of a much smaller size, using specifications to draw the required shapes with dimensions, colors, and gradients. Finally, it’s always worth considering image removal; is a picture really necessary? Can it be replaced with effective text in a smaller font, thus allowing for printing at a smaller file size with no loss in quality, or would it be beneficial to simply remove the content completely?

6. Common mistakes that can affect code to text ratio

The second mistake consists of redundant or unnecessary JavaScript. This can be a sensitive issue for any programmer. Often the lines can be blurred between what is necessary and what is not, and when something is written more than once it can be difficult to determine whether it is truly redundant. JavaScript can easily become a favorite tool for programmers who want to add that extra something to their webpage. Often JavaScript functions will be written to produce visually appealing effects or dynamic page content. While JavaScript can greatly enhance the interactivity of a web page, a developer must always be mindful of performance and keep in mind how much code is being written to produce a certain effect. Often there are prewritten JavaScript libraries that can save time and space by providing a succinct solution to a common problem. By reusing script and keeping script simple, a developer can add interactivity to a page with minimal impact on the HTML document file size.

The first mistake concerns the use of inline styles. Though inline styles may be necessary at times, often they can be avoided by using external style sheets. An excessive use of inline styles can easily bloat the file size of your HTML document. The web developer often may be using an inline style when it is not really necessary. An honest assessment of the situation may reveal that a certain percentage of the time, inline styles are used out of habit or convenience. A conscious effort to continually separate content from design will make it easier to work with external style sheets, bringing the intended design closer to its structural pair and ultimately reducing the file size of the entire web site.

The following are common mistakes that will affect the code to text ratio. These include the excessive use of inline CSS styles, redundant or unnecessary JavaScript code, and overloading the page with multimedia content.

6.1. Excessive use of inline CSS styles

Excessive use of inline CSS styles can add to the code bloating. Writing CSS rules in a separate file is more effective and efficient. When the user agent processes a document containing embedded style sheets or linked style sheets, it rebuilds the style sheet in much the same way as it does for an HTML document. After reconstructing the style sheet, it attaches to the document's tree to form a style context. With an external style sheet, you can change the look of an entire website by changing one file. If the stylesheet is attached in an external file, it must be downloaded, increasing the latency in the page loading. All the style sheets with an embedded style attribute or an imported style sheet that precedes the script, in the absence of explicit instruction otherwise, will block execution of the script until the style is loaded even without a need to use the styles in the script. This is in contrast to HTML's traditional pipelining approach, i.e., render the content as it is loaded from the server. While displaying messages such as "this page is best viewed with browsers that support CSS" will frustrate the user. Finally, with no CSS enabling the graceful degradation of styling, a CSS-disabled, CSS-incapable, or text-only user will miss out on all the styles and layout information.

6.2. Redundant or unnecessary JavaScript code

Sometimes when web developers do not know how to solve a problem with a piece of JavaScript, they will abandon it and try another method. The abandoned code still exists and is usually just put at the bottom of the page (or after the main content) with a comment, out of the way. Often, the developer will solve the problem with another solution but forget to remove the original code, or they will forget the code is there. A common example of this is using an HTML form to submit data to the server and using JavaScript to handle the event. Developers often use JavaScript input validation before submitting the form. If there are errors in the input data, the form will not be submitted, and the developer will display an error message asking the user to correct the data. The developer is likely to use AJAX to submit the data without refreshing the page for better usability, and JavaScript to handle the event and display a message to say whether the data was submitted successfully. The developer may not realize the JavaScript form event is still causing the form to submit in the background because the AJAX event handling is unfamiliar and less intuitive than it would be with a conventional form submit and page reload. This can cause an oversight of redundant JavaScript code as well as producing undesirable side-effects.

6.3. Overloading the page with multimedia content

Multimedia content such as images, video, and audio files consumes a lot of server resources and often suffers from a high code-to-text ratio. Search engine spiders and crawlers cannot "read" multimedia content, and as such, multimedia files do not contribute to a higher search engine ranking. Try to avoid using multimedia content that is purely for design or aesthetic effect. If it is necessary to use multimedia content or you believe it will enhance the user experience, try to provide "alt" text to describe the content as this will be picked up by search engine spiders. Video or audio files should also be accompanied by a transcript. This will ensure that the content is indexed, and it will also make the content accessible to users with disabilities. It is generally good practice to store all multimedia content in a subdirectory at the root of your domain to avoid an excessively deep path. This will increase the chances of search engine spiders discovering and indexing the content.

7. Benefits of optimizing your code to text ratio

There are several ways in which the code to text ratio affects the search engine's effort to spider a web page. On a general note, the more code you have and the less text, the more difficult it is for the search engine to ascertain what your page is about. When you optimize your code to text ratio, you make it easier for the search engine to determine what your page is about. This is particularly important because if your website is new or if it has no inbound links, the search engine will only be able to find your website by indexing your actual pages. An ideal web page that is in the early stages of SEO (or a page that has not been allocated any SEO resources) would index well for its own content. In other words, with no inbound links and no SEO, the page would be found in search engines by people searching directly for your website. People would find it by typing in a few keywords into a search engine, and the goal of good code to text ratio is to have your website rank well for those keywords. This is undoubtedly the most difficult form of SEO, yet also the most important. An ideal page would also have high rankings for the keywords which are not directly related to the content on the page, yet are related to the overall theme of the page. This type of indexing is often achieved by deep pages within a website which are not linked to and have page rank so low that search engine tools such as the Google toolbar will not find them. These pages are often only found by the search engine spider, and of course the goal is to have these pages indexed as efficiently as possible. An efficient indexing of a page by the search engine will not only result in the page ranking well, but it will also result in the page being indexed under the proper keywords. The page will rank well for those keywords in the short term and the long term.

7.1. Improved search engine rankings

The search engine rankings of the website can be improved by a narrow code to text ratio because the search engines are impartial - they are sent by machine and not by human. This means they do not "see" your website, they "read" it. The easier you can make it for the search engine "spider" programs to read and retrieve information from your page, the better it will be. Now, to understand the benefit of a good code to text ratio on your search engine rankings, we must first understand how search engines work. Search engines such as Google utilize the use of "spiders" which are simply programs designed to lurk through the World Wide Web and retrieve information. What information they retrieve is dependent on what the search engine is looking to achieve, the simple fact of the matter is that the easier you can make it for the search engine spiders to "read" and retrieve information from your website, the better the information they will get and the more accurately it can be stored. This will increase the chances of your site being indexed more accurately and higher than that of your competitors with a higher code to text ratio. The use of web-based applications and site search can be improved, as they function in a similar way to the search engines.

7.2. Faster website loading times

When a web page is accessed, the server has to send the page for the user's browser that then has to load and display the page. This involves downloading a lot of files and takes a significant amount of time for bloated pages. Users on dial-up connections can wait 30 seconds or more for bloated pages to load. Most users would not tolerate such a long wait and would hit the back button and look for a different site. Even users on broadband connections have to wait far too long at times. A thin amount of text should always load lightning fast. Given that a printer can only print text at 600 dpi, there is no reason to ever send more than about 30k of text. This text will load almost instantaneously, giving the user something to read while the rest of the page loads. Although this is not always a valid excuse for people who are trying to squeeze out the most money from their Google Adwords campaign, many webmasters are now creating mobile versions of their pages. These mobile pages are designed for a mobile phone's web browser over a slow 3G network. Mobile pages cannot be very image-intensive and still load in a reasonable amount of time. Text that is separate from the HTML, such as blog entries or news articles, can be shared across the two versions of the site. If there is not much text specific to the page, it may be appropriate to simply link to the full version. On the full version, this page that the user is looking at right now could be redirected to a mobile-friendly version of the same page. This is beyond the scope of the code-to-text ratio, interesting nonetheless.

7.3. Enhanced user experience

The experience you offer to your users is one of the key elements that will determine the success of your website, so it is vital to ensure they have a positive one. A good user experience can bring about many opportunities, repeat visits, and referrals to the site, while a bad one can have very negative effects. When people visit a web page, they are looking for information or to complete a task. They want to do this as quickly as possible with the least amount of effort and with the best results. If the site doesn't provide what they are looking for or is too complex to navigate, they will leave. User satisfaction and subsequently user loyalty can have a big effect on a site's success. A satisfied user is more likely to use a site more than once, maybe register, join a mailing list, or make a purchase. But if he is not satisfied, he won't come back. This is why every type of website, be it a content site, news site, blog, or an online store, can benefit from making it easier for its users to find what they are looking for. And this is what the code to text ratio can help to achieve.

8. Case studies of websites that improved their SEO rankings with code to text ratio optimization

The client had experienced a significant drop in traffic, so changes were made to improve the page's visibility in the search engines. The page was altered dramatically and exceeded the W3C recommendation with a code to text ratio of 1:32. Before optimization, the client's page had only one visible heading at the top of the page and a small paragraph of text at the bottom. The headings led to an accordion feature that when clicked would drop down extra text, and there was a large block of JavaScript. In comparison, the new page had a much clearer hierarchical structure with headings leading to relevant text, some text was moved down from the accordion feature, and the JavaScript was split into two and placed in between the text so as not to disrupt it. These changes resulted in a keyword increase from 299 to 949, and upon fetching the page in Google Webmaster Tools, they noticed that most of the JavaScript was no longer rendered. Over the forthcoming weeks, the client reported a significant increase in impressions, clicks, and average position in the search results, and this was also reflected in the organic search traffic data.

Website A: Before and after optimization results

The W3C recommendation of a 1:10 code to text ratio has been mentioned in several SEO articles and is also said to affect a web page's search engine placement. Websites with a higher code to text ratio are said to be at a disadvantage because they are not utilizing keyword-rich text on their page, therefore they decide to use techniques such as text-indent or move the text off-screen so it is not visible to the user but still accessible by the search engine. An example of this can be seen in a case study by Portent on behalf of their client Prepaid Pounds.

8.1. Website A: Before and after optimization results

The code to text ratio of website A was roughly 60:40, therefore the webmaster decided to implement changes to improve the search engine optimization of the website. Approximately 200 lines of code were removed and the overall word count was reduced by 100 words. As a result, the search engine "spiders" were able to crawl an additional 200 pages using the same amount of bandwidth. The crawl was also noticeably quicker and deeper. As highlighted in the table in the introduction, the optimization resulted in 10% more pages being indexed. Furthermore, the Yahoo! search inktomi Slurp spider crawled the pages more frequently and deeper with the additional pages being re-indexed within 48 hours. This is compared to the old site, where the changes were sometimes not reindexed for a month. From the data obtained, the changes have had a positive effect on the website's search engine rankings. For the keywords that were checked, the rankings either stayed the same or were improved. An overall increase in search engine referrals was noticed, with the majority of search engines used having showed an increase in referrals. Going by the data obtained from the search engines, it can be said that the changes have had a positive effect on the amount of traffic coming to the website via search engines.

8.2. Website B: Impact on organic search traffic

Website B was created as part of a university student project to host a competition to win tickets to a music festival. The website consisted of the competition page, an about page to provide information on the competition, a festival information page, and a contact us page. A total of 4 pages and the homepage. Pictured here is the traffic to the homepage. The website managed to generate 400% more traffic from Google by the end of the 6-week phase due to a number of factors. There is a constant increase in traffic over the time of the phase. This is due to a combination of effective use of the sitemap and the increased crawl rate due to the improved code to text ratio. The significant increase in traffic after the halfway point through the phase is a result of the implementation of the META tag description. This is a small description of the page that is visible on search engine results. This has a significant effect on the users clicking through to the page. Another important indicator of an improvement in search engine visibility is the improvement in the website's rankings for keywords. High rankings for keywords are an important facilitator for organic search traffic and one of the main objectives of search engine optimization. An analysis of the website's pages' rankings after the 6-week phase compared to the beginning of the project often provides a good indication of what has been effective during the process. In the case of the META tag description discussed earlier, a search on Google for the keyword "music festival competition" produced a number 1 page ranking. This is a vast improvement from the pre-optimization rankings and direct evidence that specific change has been effective.

8.3. Website C: User engagement and conversion rate improvements

Website C belongs to an online retail company. They cooperated with the developers at Portent Inc. The site had been through a complete redesign within the past year. The first type of store design was minimally functional, but it proved to be an SEO disaster. Webpage URLs contained numerous dynamic parameters and the site navigation was constructed using JavaScript and an off-site hosted solution. The site contained very little textual content, albeit high quality text that was resized images to look like text in an effort to maintain brand consistency with font usage. The redesigned website was an SEO state-of-the-art. Static, keyword-rich URLs permeated the website. The site navigation was recoded using standard HTML lists and nested lists. All of this was confirmed to create an end-user experience that will not change much from what a search engine spider will experience. With this in mind, the changes were made to create an optimal environment for attracting the spiders and thus achieve better getting all site pages indexed. At this measure, we have maintained that there have been no observed inequities between indexation and crawl rate. A site's ability to get indexed, and its corresponding rate of indexation by search engines from November 2008 to this day can be found from the indexation chart on the homepage. Static text was no longer an option for the client. Static text is the enemy of great design and a site containing it will consider the SEO potential of a blog with the CMS to match. Despite static being the clear choice for SEO, the decision was made to compromise between SEO and branding by implementing product and category level descriptions in an expanded accordion. Static pages for the accordion were not a viable option, so within these pages, PHP was used to create an HTML snapshot of the content and serve it as a static page at the same URL. This has proven to be an excellent method of serving dynamic content from the SEO perspective. No content was overly visible and duplicate page or URL creation were not an issue with this method.

9. Conclusion

That said, it is not too difficult to gauge a ratio as being either too high or too low. In terms of search engine optimization, ratios too high in favor of text will look suspicious to search engine spiders, especially if the text is of the same color as the background with the aim to slip in extra keywords. Any ratio less than 1:2 will likely hurt search engine rankings as there may not be enough text for the search engines to determine what the page is about. A ratio that shows obviously through use of flash or excessive images will have trouble as well, since search engine spiders cannot read and index text from images. On the other hand, a site may fail to accomplish all it can with users as ratios too low in favor of text can cause readability problems with users and may fail to capture users' attention with insufficient information.

Code to text ratio is an important aspect to consider when building or refining a website with aims to please both users and search engines. What appears to be a simple concept is actually a complex and multi-faceted issue. It is essential to consider who the target audience is and what the site is trying to accomplish. Websites designed for children will have a different optimal code to text ratio than websites designed to inform, and websites with aims to sell will have a different optimal ratio than websites designed to educate. Ratios will also vary depending upon the aims of the designer in terms of search engine optimization. Websites designed to attain high search engine rankings should aim to have a higher code to text ratio than those not as concerned with rankings. Color, style, array of media, and various other design factors will also affect what the optimal ratio will be. With so many factors stacking up, it is difficult to provide a one-size-fits-all answer to what the optimal code to text ratio is for a website.



CONTACT US

[email protected]

ADDRESS

Ireland

You may like
our most popular tools & apps