Portal 2 Console Commands: How to Enable & All Cheat Codes
Portal 2 is a puzzle-platform game developed by Valve that includes a fully functional developer console built on the Source engine. Through this console, players can modify gameplay variables, spawn objects, change game speed, toggle visual effects, and access debugging tools. Whether you are stuck on a test chamber, recording footage, or experimenting with the physics engine, the console gives you complete control over your session.
This guide explains how to enable the developer console and lists every useful command for single-player and cooperative modes.
How to Enable the Developer Console
The developer console is disabled by default. You must enable it through the in-game options menu before you can open it.
- Launch Portal 2 and reach the main menu.
- Select Options.
- Click the Keyboard / Mouse tab.
- Find the setting labeled Allow Developer Console.
- Set it to Enabled.
- Click Apply and return to the main menu.
Once enabled, you can open the console at any time by pressing the tilde key ` or ~ on your keyboard. On some non-US keyboard layouts, the default key may not work. If this happens, add -console to your Steam launch options, start the game, then type bind f11 toggleconsole in the console and press Enter to rebind the toggle key to F11.
How to Activate Cheats
Most gameplay-altering commands require cheats to be enabled first. Enter the following command before using any cheat code:
sv_cheats 1
Setting sv_cheats to 1 disables achievements and challenge mode record submission for the current session. To turn cheats off, type sv_cheats 0.
Core Gameplay Cheat Commands
These commands modify player abilities, physics, and core mechanics.
| Command | Effect |
|---|---|
| god | Grants invincibility. The player takes no damage from any source. |
| buddha | The player can take damage but will not die, stopping at 1 health point. |
| noclip | Lets you fly through walls, floors, and ceilings. Type again to disable. |
| notarget | Turrets and hostile entities will not shoot at or react to the player. |
| sv_gravity # | Changes global gravity. Default is 600. Lower values reduce gravity, higher values increase it. |
| host_timescale # | Changes game speed. 1 is normal, 0.5 is half speed, 2 is double speed. |
| firstperson | Switches the camera to first-person view. |
| thirdperson | Switches the camera to third-person view. |
| thirdperson_mayamode | Enables a free rotational camera around the player model. Hold Alt and click to move, left click to rotate, right click to zoom. |
| kill | Instantly kills the player character. |
| explode | Instantly kills the player character with an explosion effect. |
Portal Gun & Portal Commands
These commands modify how the portal gun behaves and how portals are placed.
| Command | Effect |
|---|---|
| give_portalgun | Gives the basic portal gun with no upgrades. |
| upgrade_portalgun | Upgrades the portal gun to fire both blue and orange portals. |
| sv_portal_placement_never_fail 1 | Allows portals to be placed on any surface, bypassing normal placement rules. |
| portal_draw_ghosting 0/1 | Toggles the outline of portals visible through walls. Default is 1. |
| sv_player_funnel_into_portals 0/1 | Toggles whether the player is automatically funneled into portals when near them. |
| sv_props_funnel_into_portals 0/1 | Toggles whether objects are automatically funneled into portals when near them. |
| sv_enableholdrotation 0/1 | If enabled, objects can be freely rotated with the portal gun while holding secondary fire. |
| portalgun_fire_delay # | Sets the minimum time in seconds between portal shots. Default is 0.20. |
| portalgun_held_button_fire_fire_delay # | Sets the minimum time in seconds for holding the fire button. Default is 0.5. |
Entity Spawn Commands
These commands create objects, cubes, and paint directly in front of the player.
| Command | Spawns |
|---|---|
| ent_create portal_weighted_cube | Standard Weighted Storage Cube |
| ent_create portal_companion_cube | Companion Cube |
| ent_create portal_reflector_cube | Redirection Cube for lasers |
| ent_create portal_weighted_sphere | Weighted Sphere |
| ent_create portal_weighted_antique | 1900s version of the Weighted Storage Cube from The Fall chapter |
| ent_create paint_bomb_portal | Conversion Gel stream |
| ent_create paint_bomb_speed | Propulsion Gel stream |
| ent_create paint_bomb_jump | Repulsion Gel stream |
| ent_create paint_bomb_erase | Water stream that cleans gel |
| ent_create npc_personality_core | Wheatley personality core |
Visual & Graphics Commands
These commands adjust the visual presentation of the game for screenshots, recording, or performance tuning.
| Command | Effect |
|---|---|
| cl_drawhud 0/1 | Toggles the heads-up display. Set to 0 for clean screenshots. |
| r_drawviewmodel 0/1 | Toggles the visibility of the portal gun viewmodel. |
| cl_showfps 0/1 | Displays the current frames per second in the corner of the screen. |
| cl_showpos 0/1 | Displays your exact position and velocity. Useful for speedrunning and precise portal shots. |
| mat_fastspecular 0/1 | Setting to 0 improves the quality of specular highlights at a slight performance cost. |
| r_portal_use_dlights 0/1 | Creates dynamic lighting around portals for a more dramatic visual effect. |
| r_waterforcereflectentities 0/1 | Forces water surfaces to reflect all entities in the scene. |
| mat_postprocess_enable 0/1 | Toggles post-processing effects such as bloom and color correction. |
| fog_override 0/1 | Overrides default fog settings. Required before using fog_enable or fog_skyboxenable. |
| fog_enable 0/1 | Toggles fog in the level. |
| fog_skyboxenable 0/1 | Toggles fog in the skybox. |
| cl_fov # | Changes the field of view. Default is typically 90. |
Recording & Demo Commands
These commands are used for capturing gameplay footage and creating demos.
| Command | Effect |
|---|---|
| record [demoname] | Starts recording a demo file. Portal 2 splits demos on every map change. |
| stop | Stops the current demo recording. |
| startmovie [moviename] | Opens the Source Recorder for high-quality output during demo playback. |
| endmovie | Stops the Source Recorder. |
| host_framerate # | Sets a constant framerate for the Source Recorder. |
| host_timescale # | Use with host_framerate to produce smooth slow-motion or time-lapse recordings. |
| jpeg | Takes a JPEG screenshot. Use jpeg_quality to control compression. |
| screenshot | Takes a lossless TGA screenshot. |
Miscellaneous Commands
| Command | Effect |
|---|---|
| bind [key] [command] | Binds a console command to a keyboard key. |
| unbind [key] | Removes a key binding. |
| find [term] | Searches all console commands and variables containing the specified term. |
| net_graph 1-6 | Displays network and performance information including ping, FPS, and packet loss. |
| map [mapname] | Changes the map and restarts the server. Use maps to list available maps. |
| changelevel [mapname] | Changes the map without restarting the server. |
| exec [filename] | Executes a configuration file from the cfg folder. |
| cvarlist | Displays a complete list of all console variables. |
| gameinstructor_enable 0/1 | Toggles the popup tutorial hints found throughout the campaign. |
| cm_reset_vo_progress | Resets the Cave Johnson dialogue progress in the Perpetual Testing Initiative. |
Using autoexec.cfg for Permanent Binds
If you want certain commands to run automatically every time you launch Portal 2, create a file named autoexec.cfg in the following directory:
Steam\steamapps\common\Portal 2\portal2\cfg
Add any commands or binds to this file, one per line. For example:
bind f1 "noclip" bind f2 "god" sv_cheats 1
If the file does not execute automatically, add +exec autoexec.cfg to your Steam launch options for Portal 2.
FAQ
Why does the console not open when I press tilde?
Make sure you enabled Allow Developer Console in Options > Keyboard / Mouse. On non-US keyboards, the tilde key may not be recognized. Use the launch option -console and rebind the toggle key with bind f11 toggleconsole.
Will using sv_cheats disable achievements permanently?
No. Achievements are only disabled while sv_cheats is set to 1 during the current session. Setting it back to 0 or restarting the game without cheats will restore achievement tracking.
Can I use console commands in cooperative mode?
Some commands work in co-op, but sv_cheats and gameplay-altering commands are controlled by the host. If the host does not have cheats enabled, clients cannot use cheat commands.
What is the difference between map and changelevel?
The map command restarts the server and loads the specified map fresh. The changelevel command switches maps without restarting, preserving the current server state.
Can I spawn any object in the game?
The ent_create commands listed above are the most commonly used spawn commands. You can find additional entity names by using the find command or browsing the game's entity list.
Why is noclip not working?
Make sure you entered sv_cheats 1 first. Noclip requires cheats to be enabled before it will function.
How do I reset the camera after using thirdperson_mayamode?
Type firstperson to return to the default first-person view and reset the camera.
Final Thoughts
The developer console in Portal 2 is one of the most powerful tools available in any Source engine game. Whether you are practicing speedrun techniques, capturing cinematic footage, spawning cubes for custom puzzle ideas, or simply exploring out-of-bounds areas, the commands above give you complete control over every aspect of the game. Enable the console, turn on sv_cheats, and experiment freely.
Bookmark this page and check back if new commands are discovered in future updates.






