Last modified: Feb 19, 2026 By Alexander Williams

Change Font Size in Python Output

Python is a powerful tool. You use it for data analysis and building applications. But sometimes, the default output is hard to read. The text can be too small. This is a common issue for beginners.

Changing the font size improves readability. It makes your results clearer. This guide will show you how. We will cover different environments. You will learn methods for Jupyter, IDEs, and the terminal.

Understanding Python Output Environments

Python code runs in different places. Each place handles output differently. The method to change font size depends on your environment.

The main environments are Jupyter Notebooks, Integrated Development Environments (IDEs), and the system terminal or command prompt. You must know where your code runs.

This is the first step. It tells you which technique to use. We will explore each one.

Method 1: Changing Font in Jupyter Notebooks

Jupyter Notebooks are very popular. They are great for data science. You can customize their look easily.

You can use custom CSS. This affects the whole notebook. You inject the CSS into a cell. Use the IPython.display module.


from IPython.display import HTML, display

# Define CSS style to change font size for all output
style = """
<style>
    .output_text, .input_area pre, .CodeMirror pre, .rendered_html {
        font-size: 18px !important; /* Change this value */
        font-family: monospace;
    }
</style>
"""

# Display the style to apply it
display(HTML(style))
print("This text and all future output will have a larger font.")
    

Run this code in a cell. It changes the font size for all text. The value 18px is an example. You can set it to 14px, 20px, or any size you like.

This method is persistent for the notebook session. It works on all output cells after you run it.

Method 2: Using Matplotlib for Plot Text

Often, you need to change font size in plots. This is crucial for presentations. The matplotlib library controls this.

You can set global parameters. Or you can change font size for specific elements. Use the rcParams dictionary.


import matplotlib.pyplot as plt

# Set global font size for all text elements in plots
plt.rcParams.update({'font.size': 16}) # Change this value

# Create a simple plot
plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
plt.title('Sample Plot with Custom Font Size')
plt.xlabel('X Axis Label')
plt.ylabel('Y Axis Label')
plt.show()
    

The plt.rcParams.update({'font.size': 16}) line sets the base size. It affects titles, labels, and tick marks. You can also set sizes individually.

For a specific title, use plt.title('Title', fontsize=20). This gives you fine control.

Method 3: Adjusting IDE Console Font

You might use an IDE like PyCharm or VS Code. The output appears in a built-in console. The font size is an IDE setting.

You cannot change it from Python code. You must change the IDE's preferences. This is a permanent setting for your workspace.

In PyCharm, go to File > Settings > Editor > Font. In VS Code, go to File > Preferences > Settings and search for "terminal font size" or "editor font size". Increase the value there.

This method changes how you see all text in the IDE. It is not a Python command. It is an environment adjustment.

Method 4: Terminal and Command Prompt Output

Running Python in a terminal? This could be Terminal on Mac, Command Prompt on Windows, or a Linux shell. The font size is a property of the terminal window itself.

You usually change it by right-clicking the title bar. Select 'Properties' or 'Preferences'. Look for the 'Font' tab. From there, you can select a larger font size.

Some terminals support special escape sequences. But this is not standard. The reliable way is to change the terminal settings. This affects all text, not just Python output.

Practical Example: A Readable Data Summary

Let's combine these ideas. We will create a clear, readable output in a Jupyter Notebook. We will use a larger font for text and a plot.


# Step 1: Set notebook display font
from IPython.display import HTML, display
display(HTML("<style>.output_text {font-size: 17px;}</style>"))

# Step 2: Set matplotlib font for any plots
import matplotlib.pyplot as plt
plt.rcParams['font.size'] = 14

# Step 3: Generate and display some data with clear output
import pandas as pd
data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Score': [85, 92, 78]}
df = pd.DataFrame(data)

print("DATA SUMMARY:")
print("=" * 30)
print(df.to_string(index=False)) # Using to_string for cleaner print
print("\nThe table above is now easier to read.")
print("Any plot we create will also have larger labels.")

# Step 4: Create a plot with the preset font size
plt.figure(figsize=(6,4))
plt.bar(df['Name'], df['Score'], color='skyblue')
plt.title('Student Scores', fontsize=16) # Slightly larger title
plt.ylabel('Score', fontsize=14)
plt.tight_layout()
plt.show()
    

This script does two things. It makes printed text bigger. It also ensures plots have readable labels. This is a complete approach for a data analysis notebook.

Common Issues and Solutions

You might try these methods and face problems. Here are quick fixes.

CSS not working in Jupyter: Make sure you are using the correct CSS class. Use .output_text for printed output. Refresh the browser page if needed.

Matplotlib changes not showing: You must set rcParamsbefore creating the plot. Put the configuration code at the very top of your script.

Terminal font change resets: Some terminals save settings per profile. Ensure you save the new font size in the properties window before closing it.

Conclusion

Changing font size in Python output is about knowing your environment. For Jupyter, use CSS injection. For plots, configure matplotlib. For IDEs and terminals, adjust the application settings.

The goal is better readability. Clear output helps you understand results. It also helps others when you share your work. Start with the method for your current project. Use the examples here as a guide.

Remember, there is no single Python command for all cases. Identify your output tool first. Then apply the right technique. Your eyes will thank you.