<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Bansidhar Kadiya - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Bansidhar Kadiya - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Fri, 12 Jun 2026 10:50:51 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/99tools/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Build a Case Converter Tool Using HTML, CSS, and JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ If you're looking to level up your front-end development skills by building a practical web utility, this is the guide for you. We'll code a fully functional Case Converter Tool from scratch using onl ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-build-a-case-converter-tool/</link>
                <guid isPermaLink="false">6a2bba6e86b91d1d78662a12</guid>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ HTML5 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Bansidhar Kadiya ]]>
                </dc:creator>
                <pubDate>Fri, 12 Jun 2026 07:51:10 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/uploads/covers/5e1e335a7a1d3fcc59028c64/72153c4c-a59f-4cc8-a6c5-2bd457c729ab.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you're looking to level up your front-end development skills by building a practical web utility, this is the guide for you.</p>
<p>We'll code a fully functional Case Converter Tool from scratch using only HTML, CSS, and vanilla JavaScript.</p>
<p>This lightweight application allows users to paste their content and immediately transform it into standard formats like UPPERCASE, lowercase, Title Case, and Sentence case.</p>
<p>Alongside the text formatting, we'll integrate a live character counter and set up functionality to export the final text as a PDF or Word document.</p>
<p>Grab your favorite code editor, and let's dive in.</p>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>Before you begin, you should have a basic familiarity with the following tools and concepts:</p>
<ul>
<li><p><strong>Core Web Technologies:</strong> A fundamental understanding of HTML structure, basic CSS styling, and JavaScript concepts like functions, array methods, and string manipulation.</p>
</li>
<li><p><strong>Development Environment:</strong> A code editor installed on your computer (for example, Visual Studio Code) and a modern web browser to test your application locally.</p>
</li>
</ul>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<ul>
<li><p><a href="#heading-step-1-set-up-your-project">Step 1: Set Up Your Project</a></p>
</li>
<li><p><a href="#heading-step-2-build-the-html-structure">Step 2: Build the HTML Structure</a></p>
</li>
<li><p><a href="#heading-step-3-style-the-tool-with-css">Step 3: Style the Tool with CSS</a></p>
</li>
<li><p><a href="#heading-step-4-add-javascript-functionality">Step 4: Add JavaScript Functionality</a></p>
</li>
<li><p><a href="#heading-step-5-test-your-tool">Step 5: Test Your Tool</a></p>
</li>
<li><p><a href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h2 id="heading-step-1-set-up-your-project">Step 1: Set Up Your Project</h2>
<p>Before writing any code, you need to establish a clean directory structure for your application files.</p>
<p>First, you'll need to initialize a workspace. Open your file manager and create a brand new directory to keep your work organized. Let's name this directory <code>case-converter-app</code>.</p>
<p>Then you'll generate the required files. Inside your newly created directory, set up the following three blank files:</p>
<ul>
<li><p><code>index.html</code></p>
</li>
<li><p><code>styles.css</code></p>
</li>
<li><p><code>script.js</code></p>
</li>
</ul>
<h2 id="heading-step-2-build-the-html-structure">Step 2: Build the HTML Structure</h2>
<p>Open the <code>index.html</code> file in your code editor. You'll add the structural foundation of the tool here.</p>
<p>Add the following code into your <code>index.html</code> file:</p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;title&gt;Case Converter Tool&lt;/title&gt;
    &lt;link rel="stylesheet" href="styles.css"&gt;
    
    &lt;!-- jsPDF library for generating PDF files --&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"&gt;&lt;/script&gt;
    &lt;!-- Google Fonts for a modern look --&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&amp;display=swap" rel="stylesheet"&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;div class="app-container"&gt;
        
        &lt;div class="editor-section"&gt;
            &lt;div class="textarea-header"&gt;
                &lt;span class="tip-badge"&gt;💡 Tip: Use Download buttons to save results&lt;/span&gt;
            &lt;/div&gt;
            &lt;textarea id="inputText" placeholder="Type or paste your content here..."&gt;&lt;/textarea&gt;
        &lt;/div&gt;
        
        &lt;!-- Case Conversion Buttons --&gt;
        &lt;div class="button-grid case-buttons"&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'upper')"&gt;UPPER CASE&lt;/button&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'lower')"&gt;lower case&lt;/button&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'capitalized')"&gt;Capitalized Case&lt;/button&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'title')"&gt;Title Case&lt;/button&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'sentence')"&gt;Sentence case&lt;/button&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'inverse')"&gt;iNvErSe CaSe&lt;/button&gt;
            &lt;button class="case-btn" onclick="convertCase(event, 'alternate')"&gt;aLtErNaTiNg cAsE&lt;/button&gt;
        &lt;/div&gt;

        &lt;div class="divider"&gt;&lt;/div&gt;

        &lt;!-- Action Buttons --&gt;
        &lt;div class="button-grid action-buttons"&gt;
            &lt;button class="action-btn primary-action copy-btn" onclick="copyToClipboard()"&gt;Copy To Clipboard&lt;/button&gt;
            &lt;button class="action-btn" onclick="downloadPDF()"&gt;Download PDF&lt;/button&gt;
            &lt;button class="action-btn" onclick="downloadWord()"&gt;Download Word&lt;/button&gt;
            &lt;button class="action-btn danger-action" onclick="clearText()"&gt;Clear Text&lt;/button&gt;
        &lt;/div&gt;

        &lt;!-- Real-time Statistics --&gt;
        &lt;div class="stats-panel"&gt;
            &lt;div class="stat-box"&gt;
                &lt;span class="stat-value" id="charCount"&gt;0&lt;/span&gt;
                &lt;span class="stat-label"&gt;Characters&lt;/span&gt;
            &lt;/div&gt;
            &lt;div class="stat-box"&gt;
                &lt;span class="stat-value" id="wordCount"&gt;0&lt;/span&gt;
                &lt;span class="stat-label"&gt;Words&lt;/span&gt;
            &lt;/div&gt;
            &lt;div class="stat-box"&gt;
                &lt;span class="stat-value" id="paragraphCount"&gt;0&lt;/span&gt;
                &lt;span class="stat-label"&gt;Paragraphs&lt;/span&gt;
            &lt;/div&gt;
            &lt;div class="stat-box"&gt;
                &lt;span class="stat-value" id="sentenceCount"&gt;0&lt;/span&gt;
                &lt;span class="stat-label"&gt;Sentences&lt;/span&gt;
            &lt;/div&gt;
        &lt;/div&gt;

    &lt;/div&gt;

    &lt;script src="script.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>Understanding this HTML:</p>
<ul>
<li><p><code>&lt;script src="...jspdf..."&gt;&lt;/script&gt;</code>: This links to an external library that allows JavaScript to generate PDF files directly in the user's browser.</p>
</li>
<li><p><code>&lt;textarea id="inputText"&gt;</code>: This creates the main text box where users will paste their content.</p>
</li>
<li><p><code>&lt;div class="stats-panel"&gt;</code>: This section contains <code>span</code> elements with unique IDs. You'll target these IDs with JavaScript to update the text statistics in real-time.</p>
</li>
</ul>
<h2 id="heading-step-3-style-the-tool-with-css">Step 3: Style the Tool with CSS</h2>
<p>Next, you'll give the tool a clean, professional design. Open your <code>styles.css</code> file and add the following code:</p>
<pre><code class="language-css">* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #1e293b;
}

.app-container {
    background: #ffffff;
    width: 100%;
    max-width: 900px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    padding: 2.5rem;
}

.textarea-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.tip-badge {
    background: #fef08a;
    color: #854d0e;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

textarea {
    width: 100%;
    height: 220px;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    transition: all 0.3s ease;
    background: #f8fafc;
}

textarea:focus {
    border-color: #007bff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
}

.button-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

button {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.case-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.case-btn:hover { 
    background: #e2e8f0; 
}

/* The active class highlights the selected button */
.case-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
}

.divider {
    height: 1px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}

.action-btn { 
    background: #fff; 
    border: 1px solid #cbd5e1; 
}

.action-btn:hover { 
    background: #f8fafc; 
    border-color: #94a3b8; 
}

.primary-action { 
    background: #007bff; 
    color: #fff; 
    border-color: #007bff; 
}

.primary-action:hover { 
    background: #0056b3; 
    border-color: #0056b3; 
}

.danger-action { 
    color: #ef4444; 
    border-color: #fca5a5; 
    background: #fef2f2; 
}

.danger-action:hover { 
    background: #fee2e2; 
    border-color: #f87171; 
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.stat-box { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

.stat-value { 
    font-size: 1.75rem; 
    font-weight: 700; 
}

.stat-label { 
    font-size: 0.75rem; 
    color: #64748b; 
    text-transform: uppercase; 
}
</code></pre>
<p>Understanding this CSS:</p>
<ul>
<li><p><code>body</code>: You use Flexbox to center the tool perfectly on the screen and apply a soft gradient background.</p>
</li>
<li><p><code>.app-container</code>: This creates a white, rounded card with a soft shadow to hold the user interface.</p>
</li>
<li><p><code>.case-btn.active</code>: You define an active state here. You'll use JavaScript to apply this class to the specific button the user clicks.</p>
</li>
</ul>
<p>At this stage, we've completely structured and styled the user interface. The tool will look like this:</p>
<img src="https://cdn.hashnode.com/uploads/covers/699c7b22cf5def0f6aaf982b/53e128aa-fb0d-47f3-8dca-9e3e0aa130c1.png" alt="Case Converter Tool screenshot" style="display:block;margin:0 auto" width="600" height="400" loading="lazy">

<p>Right now, the front-end is visible, but the buttons are entirely static. To make the transformations actually work, we have to write the logic in JavaScript.</p>
<h2 id="heading-step-4-add-javascript-functionality">Step 4: Add JavaScript Functionality</h2>
<p>Now you need to make the tool interactive. Open the <code>script.js</code> file and add this code:</p>
<pre><code class="language-javascript">const textArea = document.getElementById('inputText');

// Listen for typing to update statistics in real-time
textArea.addEventListener('input', updateStats);

function updateStats() {
    const text = textArea.value;
    
    document.getElementById('charCount').textContent = text.length;
    
    const words = text.trim().split(/\s+/).filter(word =&gt; word.length &gt; 0);
    document.getElementById('wordCount').textContent = words.length;
    
    const sentences = text.split(/[.!?]+/).filter(sentence =&gt; sentence.trim().length &gt; 0);
    document.getElementById('sentenceCount').textContent = sentences.length;
    
    const paragraphs = text.split(/\n+/).filter(paragraph =&gt; paragraph.trim().length &gt; 0);
    document.getElementById('paragraphCount').textContent = paragraphs.length;
}

function convertCase(event, type) {
    let text = textArea.value;
    if (!text) return; 

    // Highlight the active button
    const buttons = document.querySelectorAll('.case-btn');
    buttons.forEach(btn =&gt; btn.classList.remove('active'));
    if (event) {
        event.target.classList.add('active');
    }

    // Process the text
    switch (type) {
        case 'upper':
            text = text.toUpperCase();
            break;
        case 'lower':
            text = text.toLowerCase();
            break;
        case 'capitalized':
            text = text.toLowerCase().replace(/\b\w/g, c =&gt; c.toUpperCase());
            break;
        case 'title':
            const minorWords = ['a', 'an', 'the', 'and', 'but', 'or', 'for', 'nor', 'on', 'at', 'to', 'from', 'by'];
            text = text.toLowerCase().split(' ').map((word, index) =&gt; {
                if (index !== 0 &amp;&amp; minorWords.includes(word)) return word;
                return word.charAt(0).toUpperCase() + word.slice(1);
            }).join(' ');
            break;
        case 'sentence':
            text = text.toLowerCase().replace(/(^\s*\w|[\.\!\?]\n*\s*\w)/g, c =&gt; c.toUpperCase());
            break;
        case 'inverse':
            text = text.split('').map(c =&gt; c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase()).join('');
            break;
        case 'alternate':
            text = text.toLowerCase().split('').map((c, i) =&gt; i % 2 === 0 ? c : c.toUpperCase()).join('');
            break;
    }

    textArea.value = text;
    updateStats(); 
}

function copyToClipboard() {
    if (!textArea.value) return;
    textArea.select();
    document.execCommand('copy');
    
    const copyBtn = document.querySelector('.copy-btn');
    copyBtn.textContent = 'Copied!';
    setTimeout(() =&gt; copyBtn.textContent = 'Copy To Clipboard', 1500);
}

function clearText() {
    textArea.value = '';
    updateStats();
    document.querySelectorAll('.case-btn').forEach(btn =&gt; btn.classList.remove('active'));
}

function downloadWord() {
    if (!textArea.value) return;
    const blob = new Blob([textArea.value], { type: 'application/msword' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'converted_text.doc';
    a.click();
    URL.revokeObjectURL(url);
}

function downloadPDF() {
    if (!textArea.value) return;
    const { jsPDF } = window.jspdf;
    const doc = new jsPDF();
    const splitText = doc.splitTextToSize(textArea.value, 180);
    doc.text(splitText, 15, 15);
    doc.save('converted_text.pdf');
}
</code></pre>
<p>Understanding this JavaScript:</p>
<ul>
<li><p><code>addEventListener('input', ...)</code>: This listens to every single keystroke. Every time you type, it instantly recalculates the words, characters, and sentences.</p>
</li>
<li><p><code>convertCase(event, type)</code>: This function takes the selected style (like <code>upper</code> or <code>sentence</code>) and applies Regular Expressions (Regex) or array mapping to format the string. It also dynamically adds the <code>.active</code> CSS class to the specific button you clicked.</p>
</li>
<li><p><code>document.execCommand('copy')</code>: This is a browser command that copies the selected text directly to the user's clipboard.</p>
</li>
<li><p><code>new Blob()</code>: You use a Blob (Binary Large Object) to construct a file out of the text on the fly. This allows users to download a <code>.doc</code> file without needing a backend server.</p>
</li>
</ul>
<h2 id="heading-step-5-test-your-tool">Step 5: Test Your Tool</h2>
<p>You're now ready to evaluate your code in a real browser environment.</p>
<ol>
<li><p>Open the <code>case-converter-app</code> folder on your computer.</p>
</li>
<li><p>Double-click the <code>index.html</code> file to launch the application.</p>
</li>
<li><p>Paste a long paragraph into the text area to verify that the live statistics update accurately.</p>
</li>
<li><p>Switch between the formatting options to observe the immediate DOM manipulation, and test the export buttons to ensure files are downloading correctly.</p>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this tutorial, you successfully engineered a browser-based Case Converter Tool using vanilla JavaScript.</p>
<p>You learned how to handle continuous user inputs, manipulate string data using Regular Expressions, and trigger local file downloads directly from the front end.</p>
<p>Most importantly, you learned that modern web browsers are highly capable of handling complex document modifications locally, removing the strict need for external backend servers. This method guarantees fast processing speeds and keeps user data completely private.</p>
<p>For a live demonstration of these concepts in a production environment, feel free to test out this <a href="https://99tools.net/case-converter/">Case Converter</a> and experience how seamlessly these text transformations operate.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
